Python为此提供了一个模块:
http://docs.python.org/library/csv.html
import csv, sysfilename = 'some.csv'with open(filename, 'rb') as f: reader = csv.reader(f) try: for row in reader: print row except csv.Error, e: sys.exit('file %s, line %d: %s' % (filename, reader.line_num, e))


