Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
latlong = { "latitude": latitude,"longitude": longitude}
if os.stat(filepath).st_size==0: //check to see if file has been created if not, write first line.
with open(filepath, 'w') as outfile:
json.dump(latlong, outfile)
with open(filepath, mode='r+') as feedsjson: //this is where the file is meant to be appended.
feeds = json.load(feedsjson)
newdata = (latlong)
json.dump(feeds, feedsjson)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment