【Python】【BugList12】python自带IDLE执行print(req.text)报错:UnicodeEncodeError: 'UCS-2' codec can't encode characters in position 93204-93204
【代码】
# -*- coding:UTF-8 -*- import requests if __name__ == '__main__': target = 'https://unsplash.com/' req = requests.get(url=target) print(req.text)
【报错】
=================== RESTART: F:/PySouce/spiderphotos_1.py ===================
Traceback (most recent call last):
File "F:/PySouce/spiderphotos_1.py", line 6, in <module>
print(req.text)
UnicodeEncodeError: 'UCS-2' codec can't encode characters in position 93204-93204: Non-BMP character not supported in Tk
>>>
【规避方法】
python自带的idle无法输出一些特定符号,用其他编辑器输出(如 geany),执行结果:
【Ending】
微信公众号“粒粒的测试笔记”