How to write output file in CSV format in python?

前端 未结 4 1864
忘了有多久
忘了有多久 2021-01-07 04:11

I tried to write output file as a CSV file but getting either an error or not the expected result. I am using Python 3.5.2 and 2.7 also.

Getting error in Python 3.5:

4条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-07 04:37

    open file without b mode

    b mode open your file as binary

    you can open file as w

    open_file = open("filename.csv", "w")
    

提交回复
热议问题