Skip to content

Instantly share code, notes, and snippets.

@serhii73
Created February 4, 2017 21:10
Show Gist options
  • Save serhii73/854a8ca496acecb8ba91d290887eb8a7 to your computer and use it in GitHub Desktop.
Save serhii73/854a8ca496acecb8ba91d290887eb8a7 to your computer and use it in GitHub Desktop.
Save the file with the directory creation
filename = datetime.now().strftime("Output/%Y/%m/%d/%H/%M/%S/data") + '.csv'
os.makedirs(os.path.dirname(filename), exist_ok=True)
with open(filename, "w") as csvfile:
writer = csv.writer(csvfile)
writer.writerow(('a', 'b', 'c', 'd', 'e'))
for row in zip(a, b, c, d, e):
writer.writerow(row)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment