【python问题】UnicodeEncodeError: 'ascii' codec can't encode characters in position 306-309: ordinal not in range(128)
今天在写python爬虫的时候,遇到一个问题
UnicodeEncodeError: 'ascii' codec can't encode characters in position 306-309: ordinal not in range(128)
因为sys的编码格式问题,我们在代码前面加入引用和编码配置
import sys reload(sys) sys.setdefaultencoding('utf-8')
搞定!~