|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
import requests
url="http://placekitten.com/400/800"
headers = {
'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3314.0 Safari/537.36 SE 2.X MetaSr 1.0',
'referer':url2
}
responce=requests.get(url,headers)
with open("C:\Users\Lenovo\Desktop\hellow.py","wb") as f:
f.write(responce.content)
求解?
这样试试看,在路径那加上 r
import requests
url="http://placekitten.com/400/800"
headers = {
'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3314.0 Safari/537.36 SE 2.X MetaSr 1.0',
'referer':url
}
responce=requests.get(url,headers)
with open(r"C:\Users\Lenovo\Desktop\hellow.py","wb") as f:
f.write(responce.content)
|
|