Reading a UTF8 CSV file with Python

后端 未结 9 1626
青春惊慌失措
青春惊慌失措 2020-11-22 12:20

I am trying to read a CSV file with accented characters with Python (only French and/or Spanish characters). Based on the Python 2.5 documentation for the csvreader (http://

9条回答
  •  Happy的楠姐
    2020-11-22 12:51

    If you want to read a CSV File with encoding utf-8, a minimalistic approach that I recommend you is to use something like this:

    with open(file_name, encoding="utf8") as csv_file:
    

    With that statement, you can use later a CSV reader to work with.

提交回复
热议问题