python 保存网页HTML
来源:互联网 发布:中科大还有网络教育吗 编辑:程序博客网 时间:2024/05/16 08:42
http://www.python-requests.org/en/latest/
import requests
proxy = "10.99.60.91:8080"
url = "http://apk.gfan.com/Product/App781328.html"
r = requests.get(url, proxies = {"http":proxy})
req = r.text
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
f = open('D:\App781328.html','a')
f.write(req)
f.close()
注:如果不设置代理可能会出现Python请求connectionerror错误,Max retries exceeded with url:
http://obroll.com/max-retries-exceeded-for-url-in-requests-module-python-solved/
request是第三方库,需要安装requests-0.10.6:https://pypi.python.org/pypi/requests/0.10.6
安装命令:python setup.py install
0 0
- python 保存网页HTML
- python学习—保存网页到本地 html及pdf
- 用Python脚本保存网页
- 利用python保存网页文本
- Python MOOC简单获取网页内容并以html格式保存在本地
- 用Python下载一个网页保存为本地的 HTML文件
- python3 保存一个网页为html文件
- python抓取网页的html
- python爬取HTML网页
- Python爬虫项目,获取所有网站上的新闻,并保存到数据库中,解析html网页等(未完待续)
- python使用HTMLParser保存网页图片
- Python 爬虫网页抓图保存
- python 保存网页图片到本地
- python 爬虫入门1 网页图片保存
- Python:网页的抓取、过滤和保存
- Python抓取网页并保存为PDF
- 网页收藏小工具(一)--python保存网页
- python 保存HTML时UTF-8问题
- warning:deprecated conversion from string constant to 'char *'解决方案
- 关于ffmpeg命令行的ss参数
- 两次与死亡擦肩而过 乔布斯十年重塑美国商业
- VC 判断系统和程序是32位和64位
- C#开发——常用日期格式处理
- python 保存网页HTML
- objective-c入门
- UVa 11646 Athletics Track
- win8 win8.1 升级 Update1 无法完成更新 解决方法
- Little and Big Endian
- 20140410-1 翻译学习作品
- Pascal's Triangle -- LeetCode
- 从零开始学android<ImageView和ImageButton的使用.十.>
- Pascal's Triangle II -- LeetCode