My question is related to file-input in Python, using open(). I have a text file mytext.txt with 3 lines. I am trying to do two things with this fi
open()
mytext.txt
Try adding a input_file.seek(0) between the two loops. This will rewind the file back to the beginning, so you can loop over it again.
input_file.seek(0)