Python beginner here, I am really struggling with a text file I want to print:
{"geometry": {"type": "Point", "coordinates":
[127.03790738341824,-21.727244054924235]}, "type": "Feature", "properties": {}}
The fact that has multiple brackets confused me and it throws Syntax Error
after trying this:
def test():
f = open('helloworld.txt','w')
lat_test = vehicle.location.global_relative_frame.lat
lon_test = vehicle.location.global_relative_frame.lon
f.write("{"geometry": {"type": "Point", "coordinates": [%s, %s]}, "type": "Feature", "properties": {}}" % (str(lat_test), str(lat_test)))
f.close()
As you can see, I have my own variable for latitude and longitude, but python is throwing a syntax error:
File "hello.py", line 90
f.write("{"geometry": {"type": "Point", "coordinates": [%s, %s]}, "type":
"Feature"" % (str(lat_test), str(lat_test)))
^
SyntaxError: invalid syntax
Thanks a lot in advance for any help.