Thanks...
In fact writing the post I discover that I just need to understand a bit better the Variable type under Python.
In this case this is a dictionary.
Now I need to read a bit about dict type...
But thanks...
Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Posts made by secmast
-
RE: Extract only latitude and longitude from location
-
Extract only latitude and longitude from location
With this simple script I can get the complete location information from the unit GPS.
import location, time
a=""
label1 = ""def getlocation(sender):
location.start_updates()
time.sleep(1)
label1 = str(location.get_location())
location.stop_updates()getlocation(a)
print(a)And the result is the following
{'latitude': 49.305450439453125, 'longitude': 2.5930605239319453, 'altitude': 28.290002822875977, 'timestamp': 1542108670.452639, 'horizontal_accuracy': 140.45985579622024, 'vertical_accuracy': 10.941082954406738, 'speed': -1.0, 'course': -1.0}But, and I’m sure this is simple but my knowledge of python and programming in general is really poor.
How can I get only latitude and longitude information out of a ?
More generally how can I convert something that seems to be a mix of string and number. As the A variable have quotes and special character like “:”.