您可以通过删除换行符来预处理csv,如下所示。
import csv
content = open(“GeoIPCountryWhois.csv”, “r”).read().replace(‘rn’,’n’)
with open(“GeoIPCountryWhois2.csv”, “w”) as g:
g.write(content)
然后将GeoIPCountryWhois2用于csv阅读器。
- 疯狂猜测使用终结者可能会解决您的问题
for num,row in enumerate(csv.reader(f,lineterminator='n'))
另请参阅:http :
//docs.python.org/lib/csv-fmt-params.html



