Skip to content

Instantly share code, notes, and snippets.

@drvinceknight
Last active October 7, 2016 16:33
Show Gist options
  • Select an option

  • Save drvinceknight/b1ba1e019693828b1e34c512ed13529e to your computer and use it in GitHub Desktop.

Select an option

Save drvinceknight/b1ba1e019693828b1e34c512ed13529e to your computer and use it in GitHub Desktop.
import csv # The csv module
with open('tmp.csv', 'w') as f: # Opening a file in write mode
csvwriter = csv.writer(f)
csvwriter.writerow(['Header'])
with open('tmp.csv', 'a') as f: # Opening a file in append mode
csvwriter = csv.writer(f)
for k in range(100): # Looping over first 99 integers
csvwriter.writerow([k])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment