【代碼】
# -*- 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】
微信公眾號“粒粒的測試筆記”

