Skip to content

解决在windows 10系统下报gbk编码错误的问题#3

Merged
lispczz merged 1 commit intolispc:masterfrom
nl8590687:nl8590687-patch-1
Jan 28, 2020
Merged

解决在windows 10系统下报gbk编码错误的问题#3
lispczz merged 1 commit intolispc:masterfrom
nl8590687:nl8590687-patch-1

Conversation

@nl8590687
Copy link
Copy Markdown
Contributor

实测代码在windows 10系统Python 3.6下运行报错:
Traceback (most recent call last):
File ".\generate_data.py", line 13, in
amap_code_to_city = load_amap_cities()
File ".\generate_data.py", line 10, in load_amap_cities
return dict([line.strip().split() for line in open('adcodes').readlines()])
UnicodeDecodeError: 'gbk' codec can't decode byte 0x82 in position 15: illegal multibyte sequence

运行环境:
Windows 10
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32

修改后:
运行通过

实测代码在windows 10系统Python 3.6下运行报错:
Traceback (most recent call last):
  File ".\generate_data.py", line 13, in <module>
    amap_code_to_city = load_amap_cities()
  File ".\generate_data.py", line 10, in load_amap_cities
    return dict([line.strip().split() for line in open('adcodes').readlines()])
UnicodeDecodeError: 'gbk' codec can't decode byte 0x82 in position 15: illegal multibyte sequence

运行环境:
Windows 10
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32

修改后:
运行通过
@Juster07
Copy link
Copy Markdown

win7 +1,感谢

@lispczz lispczz merged commit 6761d77 into lispc:master Jan 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants