Here is my code,
for line in open(\'u.item\'): #read each line
whenever I run this code it gives the following error:
Sometimes when open(filepath) in which filepath actually is not a file would get the same error, so firstly make sure the file you're trying to open exists:
open(filepath)
filepath
import os assert os.path.isfile(filepath)
hope this will help.