Hi
I made a loop in a .txt file and it works as long as I it finds what it is looking for.
But when it not found what it is looking for in the .txt file I got an error.
And when I try wiht a ELSE statment, it Always return this even if the IF statement is true.
def findrow(num):
modulfile_open = open(modulfile, 'r') # open file for reading
for line in modulfile_open:
values = line.split(",")
if values[0] == num:
newNum = values[1]
print(values[1]) #print to see that works
modulfile_open.close()
return newNum
else:
newNum2 = ' Assembly not found'
return newNum2
Anyone that can tell me what is wrong?
//Wilnix