import requests
user_id = 12345
url = 'https://yandex.ru/'
r = requests.get(url)
with open('test.html', 'w') as output_file:
output_file.write(r.text.encode('cp1251'))
<Ошибка>
Traceback (most recent call last):
File "C:\Users\Ivan\Desktop\python\parser.py", line 6, in
output_file.write(r.text.encode('cp1251'))
File "C:\Python39\lib\encodings\cp1251.py", line 12, in encode
return codecs.charmap_encode(input,errors,encoding_table)
UnicodeEncodeError: 'charmap' codec can't encode character '\u2212' in position 88884: character maps to
Ошибка>