2 回答
TA贡献1797条经验 获得超6个赞
我不明白什么是测量时间,但您可以尝试:
import csv
f1 = open("record.csv", "r")
reader = csv.DictReader(f1, delimiter='\t') #DictReader let you read the csv header
f2 = open("workingfile.csv", "r")
reader2 = csv.DictReader(f2, delimiter='\t')
f3 = csv.writer(open("newfile.csv", "w"))
record = [] #create a list to append values from first file
workingfile = [] #create a list to append values from second file
for row in reader:
record.append(row['DOE']) #take values from DOE column
print(values)
for row in reader2:
workingfile.append(row['Day_of_exp']) #take values from Day_of_exp column
print(values2)
for v in workingfile:
if v in record:
f3.writerow([v])
print(v)
f1.close()
f2.close()
这适用于比较不同 csv 中的两列。
添加回答
举报