Problem:
I am getting an interesting error: valueerror: mixing iteration and read methods would lose data while I’m trying to run my script on python. I have no idea about this problem.
I am trying to open a text file in my program and read it. Please check my code snippet below if you can find the error from it.
for i in range(len(test_file):
print test_file.readline()
test_file.close()
print test_file
I think I am doing something wrong with using the readline() function. I am looking forward to having a solution.
Thanks, guys.