Here is my code,
for line in open(\'u.item\'):
#read each line
whenever I run this code it gives the following error:
If you are using Python 2 the following will the solution:
import io
for line in io.open("u.item", encoding="ISO-8859-1"):
# do something
Because encoding parameter doesn't work with open(), you will be getting the following error:
TypeError: 'encoding' is an invalid keyword argument for this function