import csv
def read(file1):
with open(file1, 'r') as file:
rd = csv.reader(file)
for r in rd:
print(r)
def write(file2):
with open(file2, 'w', newline='') as file:
w= csv.writer(file)
w.writerow(["1", "2", "3"])
w.writerow([1, "4", "5"])
w.writerow([2, "6", "7"])
f1="input.csv"
f2="output.csv"
read(f1)
write(f2)
Comments
Leave a comment