Skip to content

Instantly share code, notes, and snippets.

@pasindud
Created September 2, 2018 11:46
Show Gist options
  • Select an option

  • Save pasindud/613dc544fac187ae0c186686115e2c2a to your computer and use it in GitHub Desktop.

Select an option

Save pasindud/613dc544fac187ae0c186686115e2c2a to your computer and use it in GitHub Desktop.
import sys
import json
# python data.py mapit_response_form.tsv output_dir
i = 1
for x in open(sys.argv[1]):
parts = x.split("\t")
fname = parts[1].lower().strip().replace(" ", "_")
name = parts[1]
techno = [x.strip() for x in parts[2].split(",")]
companyweb = parts[3]
googleMaps = parts[4]
hrcontact = parts[5]
careepage = parts[6]
print fname
data = {
"id":i,
"name": name,
"technology_stack":techno,
"company_site":companyweb,
"location": googleMaps,
"link":[{
"name":"Career",
"link": careepage,
}]
}
print data
i+=1
with open(sys.argv[2] + "/" + fname + ".json", 'w') as outfile:
json.dump(data, outfile, indent=4, sort_keys=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment