Quote:
I am using Nested for loop, the problem that inner loops runs only on first line of outer loop and stops.
you need to understand that
fsid
is an object of type file, and it contains a pointer telling actual position in file.
When end of file is reached, it knows that there is nothing more to read.
You need to reset the pointer position to beginning of file before reading again with inner loop. The easiest solution is open the file just before starting the inner loop, and close the file just at the end of inner loop.
flooback=open('loopback.txt')
fsid=open('sid.txt')
bucket=None
for line in flooback:
bucket=line.strip()
for s in fsid:
s=s.strip()
if s==bucket:
print(s)