解决UnicodeEncodeError: 'ascii' codec can't encode characters in position

解决UnicodeEncodeError: 'ascii' codec can't encode characters in position_第1张图片
最近用Python写了些爬虫,在爬取一个gb2312的页面时,抛出异常:UnicodeEncodeError: 'ascii' codec can't encode characters in position 21-23: ordinal not in range(128)解决方案如下:首先设置系统的默认编码为utf-8:import sys re...

继续阅读:码农场 » 解决UnicodeEncodeError: 'ascii' codec can't encode characters in position

原文链接:http://www.hankcs.com/program/python/asciicodec-cant-encode-characters-in-position-unicodeencodeerror.html

你可能感兴趣的:(解决UnicodeEncodeError: 'ascii' codec can't encode characters in position)