How to get lt, lg values from string

chandu40

New member
Joined
Apr 22, 2021
Messages
4
Programming Experience
1-3
Hello Everyone,

I have below string, i need to extract lt, lg values into new dictionary if s : N

how to do this. please help me

"\n{\n\t1619059179095 : \n{\n\tac : 13.0990000;\n\tlg : 58.4269473;\n\tlt : 22.4404507;\n\ts : N\n}\n}"

Thanks
Chandu
 
Last edited:
The text looks almost like JSON. Why not use a try using JSON parser to get the values and then put the values into a dictionary?

If current production JSON parsers reject your string (because of the non-string value 'N'), then rolling your own JSON parser is not that hard. It's part of why JSON has gain so much popularity -- human readable, and writing a JSON parser is 10x easier than writing an XML or YAML parser.

Or your could just simple do string searches or use regular expressions.
 
Back
Top Bottom