My code as below tries to write a list of list into a text file in CSV format,
import csv
villains = [ ['Doctor', 'No','w'], ['Rosa', 'Klebb','w'], ['Mister', 'Big','w'],['Auric', 'Goldfinger','w'],\
['Ernst', 'Blofeld','w']]
with open('villains','wt') as fout:
csvout=csv.writer(fout)
csvout.writerows(villains)
But I find that if I open the file using Excel (after changing the file name from villains to villains.csv), there are blank lines in between. How do I remove them? BTW, if I change the file name from villains to villains.txt and open with Notepad, I can't spot any blank lines. What happened here?