Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unicode decode error: how to skip invalid characters [duplicate]

Tags:

python

Is there any way to preprocess text files and skip these characters?

UnicodeDecodeError: 'utf8' codec can't decode byte 0xa1 in position 1395: invalid start byte
like image 471
Maximus S Avatar asked Nov 28 '22 14:11

Maximus S


1 Answers

Try this:

str.decode('utf-8',errors='ignore')
like image 117
Irshad Bhat Avatar answered Dec 05 '22 13:12

Irshad Bhat