csv.write skipping lines when writing to csv

后端 未结 5 1506
旧巷少年郎
旧巷少年郎 2021-01-01 11:50

I am trying to write to a csv file via the following

file = open(\'P:\\test.csv\', \'a\') 

fieldnames = (\'ItemID\', \'Factor\', \'FixedAmount\')
wr = csv.D         


        
5条回答
  •  粉色の甜心
    2021-01-01 12:21

    Twenty quatloos says you're running under windows (well, a hundred, given that your file is called P:\test.csv). You're probably getting extra \rs.

    [edit]

    Okay, since using binary mode causes other problems, how about this:

    file = open('P:\test.csv', 'w', newline='')
    

提交回复
热议问题