I'm trying to print out a text file word by word, but it keeps giving me an error.
The text file is the bee movie script, so am I getting the error because the file is too big?
My code:
with open ('Script.txt', 'r') as file:
for line in file:
for word in line.split():
print(word)
The error:
Traceback (most recent call last):
File "C:/Users/itsan/Desktop/Coding/Python/Python Scripts/System/Bee Movie Script/main.py", line 2, in <module>
for line in file:
File "C:\Users\itsan\Desktop\Coding\Python\Python Install\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 252: character maps to <undefined>