标签:users color tar 乱码 line 解决方案 close bsp pen
代码中红色字体为解决方案:
1 #-*-coding:utf-8-* 2 import csv 3 4 filename=‘C:\Users\yaru\Desktop\Senti_Value(1).csv‘ 5 6 data=[] 7 try: 8 with open(filename) as f: 9 reader = csv.reader(f) 10 header = reader.next() 11 data = [row for row in reader] 12 except csv.Error as e: 13 print "Error reading CSV file at line %s: %s" % (reader.line_num,e) 14 sys.exit(-1) 15 16 if header: 17 print ‘,‘.join(header) 18 print ‘============‘ 19 for datarow in data: 20 print ‘,‘.join(datarow) 21 f.close()
标签:users color tar 乱码 line 解决方案 close bsp pen
原文地址:http://www.cnblogs.com/ghuosaao/p/6029071.html