拉瑟是对的。这是一个逗号分隔的值文件,因此您应该使用
csvmodule。一个简单的例子:
from csv import reader# testinfile = ['A,B,C,"D12121",E,F,G,H,"I9,I8",J,K']# real is probably like# infile = open('filename', 'r')# or use 'with open(...) as infile:' and indent the restfor line in reader(infile): print line# for the test input, prints# ['A', 'B', 'C', 'D12121', 'E', 'F', 'G', 'H', 'I9,I8', 'J', 'K']


