Skip to content

Instantly share code, notes, and snippets.

@juanriaza
Created May 4, 2013 12:50
Show Gist options
  • Save juanriaza/5517413 to your computer and use it in GitHub Desktop.
Save juanriaza/5517413 to your computer and use it in GitHub Desktop.
import tablib
lines = csv_data.split('\n')[:-1]
clean = lambda data: map(lambda e: e.strip('"'), data.split(','))
headers = clean(lines[0])
data = [clean(contact) for contact in lines[1:]]
parsed_data = tablib.Dataset(*data, headers=headers)
print parsed_data.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment