Python扒站源代码+保存到桌面
代码:
'''听风博客网-扒站+保存'''
import os
import requests #导包
url_requests=str(input('请输入要扒站的目标网址:'))
if url_requests==url_requests:
result=requests.get(url_requests)
print(result.status_code)
print(result.url)
print(result.headers)
print(result.text)
if result.status_code==200:
print('听风博客网扒站成功')
result.encoding='utf-8'
text=result.text
print('目录切换桌面')
os.chdir('C:\\Users\Administrator\Desktop')
with open('fendou.txt','w',encoding='utf-8')as f:
f.write(text)
f.close()
else:
print('听风博客网扒站失败')
else:
print('听风博客网扒站输入错误')
© 版权声明
THE END
暂无评论内容