with open(sys.argv[2]) as f:
processlist = f.readlines()
for a in range(0,1):
process = processlist[a]
print process
for b in range(0,3):
process1 = process.split()
print process1[b]
你知道吗系统argy[2]文件只有两个句子
Sunday Monday
local owner public
我试着一次读一句话,每句话我试着一次读一个单词。。。。我能够得到的东西,我需要个别,但循环不迭代。。。它在第一次迭代后停止。。。。你知道吗
要回答循环为什么不迭代的问题:
只包含元素
0
,因为the upper bound is not included in the result。同样地当作为列表查看时,将是
[0,1,2,3,4]
。你知道吗@HennyH的答案演示了迭代文件的正确方法。你知道吗
你的档案会产生
相关问题 更多 >
编程相关推荐