0

When reading a file with this code faced error:

with open("hist", "rb") as f:
    hist = pickle.load(f)


hist = pickle.load(f)

Error:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xa0 in position 3582: ordinal not in range(128)
ShivaGaire
  • 2,283
  • 1
  • 20
  • 31
SarwarKhan
  • 133
  • 1
  • 2
  • 10

1 Answers1

2

Try setting the encoding while load.

Ex:

hist = pickle.load(f, encoding='utf-8') #or'latin1' or 'bytes'
Rakesh
  • 81,458
  • 17
  • 76
  • 113