I have some very simple piece of code:
import csv
out = csv.writer(open('test.csv', 'wb'), delimiter=",")
out.writerow([u"value1", u"value2", u"value3"])
It sometimes works, but most of the time it doesn’t! I remember I used writerow previously and it was working just fine, what am I missing here?
To make the problem clearer: the csv file remains empty although the above code is executed without any errors
I modified the code to look as follows:
So all I’ve done is that I separated the
open('test.csv', 'wb')and assigned it tof, so that I can usef.close()at the end. It works perfectly this way.