Last active
May 24, 2020 10:41
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
def read_csv(file): | |
csv_file = open(file) | |
reader = csv.reader(csv_file) | |
alpha = list(reader) | |
csv_file.close() | |
return alpha | |
def write_csv(file,method,content): | |
csv_file = open(file,method,newline='') | |
fieldnames = content[0] | |
writer = csv.DictWriter(csv_file,fieldnames=fieldnames) | |
writer.writeheader() | |
writer.writerows(content) | |
print('created csv file') | |
csv_file.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment