-
-
Save anonymous/d4a89d73de748b7695a51c4952346f55 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{ | |
"longitude":51.5074, | |
"latitude":0.1278 | |
}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{ | |
"longitude":51.5074, | |
"latitude":0.1278 | |
}, | |
"longitude":51.5074, | |
"latitude":0.1278 | |
}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
latlong = { "latitude": latitude,"longitude": longitude} | |
##first time run | |
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) | |
else: | |
##apending the json dict | |
with open(filepath, mode='r+') as feedsjson: //this is where the file is meant to be appended. | |
feeds = json.load(feedsjson) | |
newdata = (latlong) | |
feeds.update(newdata) | |
json.dump(feeds, feedsjson) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment