import csv
import os
cwd = os.getcwd()
print ("Current folder is %s" % (cwd) )
  
csvfile = open( cwd + '\data\eclipse\change-metrics.csv','r')
reader = [each for each in csv.DictReader(csvfile, delimiter=';')] #这里设置分号为分隔符
  
for row in reader:
 print(row['classname'])
csvfile.close()
path="file_to_convert.csv"

reader = list(csv.reader(open(path, "rU"), delimiter=','))
writer = csv.writer(open(path, 'w'), delimiter=';')
writer.writerows(row for row in reader)

 

发表评论

邮箱地址不会被公开。 必填项已用*标注