Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

有点错误,难道是因为ID里的字符? #1

Open
Gawainc opened this issue Jun 3, 2018 · 4 comments
Open

有点错误,难道是因为ID里的字符? #1

Gawainc opened this issue Jun 3, 2018 · 4 comments

Comments

@Gawainc
Copy link

Gawainc commented Jun 3, 2018

Login successfully as XXXคิดถึง
Traceback (most recent call last):
File "get_user_info.py", line 65, in
save_data(friends_list)
File "get_user_info.py", line 33, in save_data
json_file.write(json.dumps(frined_list,ensure_ascii=False))
UnicodeEncodeError: 'gbk' codec can't encode character '\u0e04' in position 20: illegal multibyte sequence

@Timerunning
Copy link

python版本问题吧,你用低版本的试试

@yangxuanxc
Copy link
Owner

我这里用的是python3.6 你那里按照提示应该是编码错误了,我估计是版本问题。

@sym44
Copy link
Contributor

sym44 commented Jun 4, 2018

使用3.6.3,有同样的问题。
应该是utf-8字符识别问题,可以用
import codecs

with codecs.open(out_file_name, 'w', encoding='utf-8') as json_file:
json_file.write(json.dumps(frined_list,ensure_ascii=False))

来修复该问题。已提交pull request @yangxuanxc @Gawainc

@yangxuanxc
Copy link
Owner

已合入,thanks

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

No branches or pull requests

4 participants