Skip to content

Instantly share code, notes, and snippets.

@jbspeakr
Created June 25, 2013 14:45
Show Gist options
  • Save jbspeakr/5859033 to your computer and use it in GitHub Desktop.
Save jbspeakr/5859033 to your computer and use it in GitHub Desktop.
Check http://www.datahack.it for further conversion snippets!
import csv
import yaml
i = open('input.csv', 'r')
reader = csv.DictReader(i)
data = yaml.safe_dump([row for row in reader], canonical=False,
encoding='utf-8', allow_unicode=True,
default_flow_style=False)
o = open('output.yaml', 'w')
o.write(data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment