0

enter image description hereThis error occurs when I open, read, and print out my file. I'm not sure why this is happening and I'm not using pandas. my file prints out then exits with this error. How do I fix this?

This is the code I've written for this error to occur.

walmartFile = open('walmart_inventory.csv', 'r')

for line in walmartFile: print(line)

G4RR1SON
  • 1
  • 1
  • 1
    Welcome to Stack Overflow. In order to make sense of a text file properly, you must know its *encoding*, and specify that when opening the file. Please see the linked duplicate for details. Any time that it works without taking this step is effectively an accident: the file contents happen to work with the encoding that is assumed by default. – Karl Knechtel Apr 03 '23 at 03:53

0 Answers0