python-UnicodeEncodeError: ‘ascii’ codec can’t encode characters in position
python3:
import sys
import codecs
sys.stdout=codecs.getwriter('utf8')(sys.stdout.detach())
或者
import sys
import io
sys.stdout = sys.__stdout__ = io.TextIOWrapper(sys.stdout.detach(), encoding='utf-8', line_buffering=True)
python2:
import sys
reload(sys)
sys.setdefaultencoding('utf8')
转载自:https://blog.csdn.net/qq_32125629/article/details/80715932