Skip to content

Instantly share code, notes, and snippets.

@fumingshih
Created March 28, 2012 21:34
Show Gist options
  • Save fumingshih/2230787 to your computer and use it in GitHub Desktop.
Save fumingshih/2230787 to your computer and use it in GitHub Desktop.
How to print a list of tuples to file as csv
open('tuples.csv', 'w').write('\n'.join('%s %s' % x for x in your_lst))
# suppose you have a lst of tuples like
# lst = [(item11, item12), (item21, item22), ...(item_n1, item_n2)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment