I am testing some really simple code with Python 3. For some reason, the following code generates an empty output, instead of writing a line
import csv
output = open('hello world.csv', 'w',newline='')
wr = csv.writer(output, quoting=csv.QUOTE_ALL)
wr.writerow('hello world')
If I try the commands in the interpreter, .writerow()
returns a number. The following example is the one used in the documentation page:
>> import csv
>>> spamWriter = csv.writer(open('eggs.csv', 'w', newline=''), delimiter=' ',
... quotechar='|', quoting=csv.QUOTE_MINIMAL)
>>> spamWriter.writerow(['Spam'] * 5 + ['Baked Beans'])
40
>>> spamWriter.writerow(['Spam', 'Lovely Spam', 'Wonderful Spam'])
37