Skip to content

Instantly share code, notes, and snippets.

@willkurt
Created March 15, 2013 19:02
Show Gist options
  • Save willkurt/5172225 to your computer and use it in GitHub Desktop.
Save willkurt/5172225 to your computer and use it in GitHub Desktop.
processing location tree
import csv
with open("locations.csv","w") as csvfile:
cw = csv.writer(csvfile)
cw.writerow(["country","city","region1","location1","location2","location3"])
with open("Location_Tree.csv","r") as infile:
for l in infile:
cw.writerow(map(lambda x: x.strip().replace('"',''),l.split('~')))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment