I'm trying to read info from a file and print it's information. Using a test program, I could get it working like this:
file = open("cooltextfile.txt", "r")
for line in file:
if "BobRoss" in line:
print(line)
Using above method, it prints all lines containing "Bob Ross".
However, when I use it in my main program like this, it's not even printing the line if I tell it to print the whole line:
number = 0
index = 0
textFile = open("cooltextfile.txt", "r")
lineInfo = textFile.readlines()
for line in textFile:
index += 1
print(line) # - An attempt to print the entire line
if "BobRoss" in line:
number += 1
print(str(number) + ". " + line)
print("Order: " + lineInfo[index])
textFile.close()
Upon further inspection it would seem that the for-loop never starts. Any reason as to what could be causing the loop to not start?