UnicodeEncodeError

import requests

res = requests.get('https://localprod.pandateacher.com/python-manuscript/crawler-html/spider-men5.0.html')

print(res.status_code)

 

novel = res.text

k=open('《网页源代码》.txt','a+')

k.write(novel)

k.close()

 

Traceback (most recent call last):
  File "e:\python_pacong\book_0.py", line 7, in <module>
    k.write(novel)
UnicodeEncodeError: 'gbk' codec can't encode character '\xa9' in position 3738: illegal multibyte sequence

不知道你这个问题是否已经解决, 如果还没有解决的话:

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 以帮助更多的人 ^-^