UnicodeDecodeError charmap codec can't decode byte X in position Y character maps to undefined

preview_player
Показать описание
#python tutorial: #codefix #python #python_tutorial
Problem: UnicodeDecodeError 'charmap' codec can't decode byte X in position Y character maps to undefined

In this video i will show you why UnicodeDecodeError 'charmap' codec can't decode byte X in position Y character maps to undefined error comes and how to solve it.

Solution: UnicodeDecodeError 'charmap' codec can't decode byte X in position Y character maps to undefined because we are using wrong encoding type which is unable to decode the file characters we are trying to read through our python program.
here are commonly used encoding types in python
#CP1252
#Latin-1
#UTF-8

so if you modify your encoding type it will fix this error.

here is exact code i used in this python program
#UnicodeDecodeError: 'char map' codec can't decode byte X in position Y: character maps to undefined

# Commonly used Encoding Types are:
#CP1252
#Latin-1
#UTF-8

import csv
for row in rd:
print(row) .
▶▶▶Learn More◀◀◀

Рекомендации по теме