且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

循环无效-字符串(Python)

更新时间:2023-11-07 14:17:52

无法告诉您原因,但是可以通过简单地将for row in reader:替换为for row in reader.readlines():来解决.如果不能一次导入所有内容,则可能需要手动处理迭代.

Can't tell you why but this can be fixed by simply replacing for row in reader: with for row in reader.readlines():. If everything can't be imported at once, then you'll probably need to handle iteration manually.

我刚刚意识到我在使此工作上做了些不同的事情:

I just realized I did something slightly different in getting this to work:

outer = codecs.open(<outer loop file).readlines()
inner = codecs.open(<inner loop file).readlines()

for o in outer:
   for i in inner:
       print o