import csv
input = ['abc,"a string, with a comma","another, one"']parser = csv.reader(input)for fields in parser: for i,f in enumerate(fields): print i,f # in Python 3 and up, print is a function; use: print(i,f)
结果:
0 abc1个字符串,带逗号另外2个,一个

import csv
input = ['abc,"a string, with a comma","another, one"']parser = csv.reader(input)for fields in parser: for i,f in enumerate(fields): print i,f # in Python 3 and up, print is a function; use: print(i,f)
结果:
0 abc1个字符串,带逗号另外2个,一个