Python" for in"循环只运行一次

时间:2018-03-23 15:35:05

标签: python loops csv

我有这个脚本:

#!/usr/bin/python

import csv
import sys

csv_file = csv.reader(open('sample_1.csv', "rb"), delimiter=';')
csv_file_sounds = csv.reader(open('sample_2.csv', "rb"), delimiter=';')

for row in csv_file:
        for row2 in csv_file_sounds:
                if row2[21] == row[0]:
                        print row2[15]

" for csv_file"循环只运行一次,但我在sample_1.csv中有很多行。我错过了什么?我想在sample_1.csv

中找到sample_2.csv个字符串

(英语不是我的母语;请原谅我的任何错误。)

0 个答案:

没有答案