编码csvreader

时间:2015-07-16 01:59:22

标签: python csv

我有一个latin1编码文件。我如何使用csv完成与以下相同的操作?

>>> import csv
>>> with open(filepath, 'rb') as csvfile:
...     reader = csv.DictReader(csvfile, delimiter='\t', encoding='iso-8859-1')

2 个答案:

答案 0 :(得分:3)

with open(filepath, "r", encoding="ISO-8859-1") as csvfile:
    reader = csv.DictReader(csvfile)

答案 1 :(得分:0)

这是一种可以做到的方法:

DATE