python - nested loop code not working please -
with open(sys.argv[2]) f: processlist = f.readlines() in range(0,1): process = processlist[a] print process b in range(0,3): process1 = process.split() print process1[b]
sys.argy[2 ] files has 2 sentences
sunday monday local owner public
i trying read once sentence @ time , in each sentence trying access 1 word @ time.... able things need individually loop doesn’t not iterate... stops after first iteration....
with open(sys.argv[2]) f: line in f: #iterate on each line #print("-"*10) demo word in line.rstrip().split(): #remove \n split space print(word)
over file produce
---------- sunday monday ---------- local owner public
Comments
Post a Comment