look at my code and help me #29842
Unanswered
notforgetwyn
asked this question in
New to GitHub
Replies: 1 comment
-
|
Could you put your code in a code block, so lines and indentation are preserved? It's hard to impossible to read otherwise. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
this is my first time to writing code,I want to gain the data and keep it to a file(wn.html)
import requests ad1='https://m.bcoderss.com/' ad2={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36'} ad3=requests.get(ad1,headers=ad2,) name=ad3.text ad4=str(name) with open('wn.html',mode='w') as ad5: ad5.write(ad4)this is the result
Traceback (most recent call last): File "C:\Users\Administrator\PycharmProjects\pythonProject3\main.py", line 8, in <module> ad5.write(ad4) UnicodeEncodeError: 'gbk' codec can't encode character '\ufeff' in position 0: illegal multibyte sequenceBeta Was this translation helpful? Give feedback.
All reactions