Created
May 4, 2013 12:50
-
-
Save juanriaza/5517413 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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