Skip to content

Instantly share code, notes, and snippets.

@lucaspg96
Last active November 23, 2017 17:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucaspg96/26afa9ac3d59322e604696514c6e93ae to your computer and use it in GitHub Desktop.
Save lucaspg96/26afa9ac3d59322e604696514c6e93ae to your computer and use it in GitHub Desktop.
from pymongo import MongoClient as mc
collection = mc().datavis.menus
found = 0
not_found = 0
with open("locations-2017-11-16 12:42:08.068035.txt") as f:
for line in f:
place,coords= line.split(" -> ")
if not collection.find_one({"place":place}):
place = place.rstrip()
if not collection.find_one({"place":place}):
place = place.rstrip()
print("{} -> {}".format(place,len(place)))
not_found+=1
else:
found+=1
else:
found+=1
print("\n\n{} locations found. {} not found".format(found,not_found))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment