Skip to content

Instantly share code, notes, and snippets.

@Ailuropoda1864
Created September 8, 2017 06:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ailuropoda1864/2cf0823ac30b6963479b6a4fbf14068f to your computer and use it in GitHub Desktop.
Save Ailuropoda1864/2cf0823ac30b6963479b6a4fbf14068f to your computer and use it in GitHub Desktop.
append a row to a csv file
import csv
def append_to_csv(csvfile, entry):
"""
append a row to a csv file
:param csvfile: the path to a .csv file
:param entry: a list representing a row in the .csv file
:return: None
"""
with open(csvfile, 'a', newline='') as f:
entry_writer = csv.writer(f, delimiter=',', quoting=csv.QUOTE_MINIMAL)
entry_writer.writerow(entry)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment