Why am I not getting any output? | Sololearn: Learn to code for FREE!


Why am I not getting any output?

Python csv file https://code.sololearn.com/cI0974r0F29n/?ref=app

4/27/2021 6:25:51 AM


1 Answer

New Answer


seems like you are only writing into the file. [CHECK THIS] import csv with open('companies.csv','w') as csvfile: fieldnames =['name','type'] writer=csv.DictWriter(csvfile, fieldnames= fieldnames) writer.writeheader() writer.writerow({'name':'codecademy','type':'slave'}) writer.writerow({'name':'Googke','type':'freedom'}) with open("companies.csv","r") as f : a=csv.reader(f) for i in a: print(i) f.close()