UnicodeDecodeError 'utf-8' 编解码器无法解码 - 使用 python shapefile reader
UnicodeDecodeError 'utf-8' codec can't decode - using python shapefile reader
我正在尝试读取 shapefile
r = shapefile.Reader(filepath, encoding = "utf-8")
但是当我尝试从 .records() 对象中获取值时,如:
r.records()[0]
它 returns 对我来说是以下错误:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 4: invalid continuation byte
这意味着您的文件未使用 utf-8 编码。尝试:ISO8859-1
如果您使用 Linux(或 git-bash 使用 Windows),您可以使用 file
命令找出编码.
我正在尝试读取 shapefile
r = shapefile.Reader(filepath, encoding = "utf-8")
但是当我尝试从 .records() 对象中获取值时,如:
r.records()[0]
它 returns 对我来说是以下错误:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 4: invalid continuation byte
这意味着您的文件未使用 utf-8 编码。尝试:ISO8859-1
如果您使用 Linux(或 git-bash 使用 Windows),您可以使用 file
命令找出编码.