import csvpath = "sample.csv"f = open(path,"r",encoding="utf_8")path = "sample2.csv"f2 = open(path,"w",encoding="utf_8",newline='')reader = csv.reader(f)writer = csv.writer(f2)for row in reader: row = list(map(lambda x: '0' if x == '' else x,row)) writer.writerow(row)f.closef2.close
Standard input is empty
Standard output is empty
Traceback (most recent call last): File "./prog.py", line 3, in <module> f = open(path,"r",encoding="utf_8") FileNotFoundError: [Errno 2] No such file or directory: 'sample.csv'
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!