Python分段下载文件,python分段,下载较大文件时分段下载会
Python分段下载文件,python分段,下载较大文件时分段下载会
下载较大文件时分段下载会加速下载过程,几乎所有下载软件都有类似的特性。在python中如何实现分段下载文件呢?```python
import urllib2req = urllib2.Request('http://www.python.org/')
下载19000到20000字节的片段
req.headers['Range'] = 'bytes=%s-%s' % (19000, 20000)f = urllib2.urlopen(req)pagerange = f.headers.get('Content-Range')print pagerangebytes 19000-19189/19190print repr(f.read())'</div>\n\tCopyright &copy; 1990-2012, <a href=\'/psf/\'>Python Software Foundation</a><br/>\n\t<a href="/about/legal">Legal Statements</a>\n </div>\n\n\n </div>\n </div>\n</body>\n</html>\n\n\n\n\n\n\n'
```
相关内容
- 400行python 实现http/https 代理服务器,400行python,#!/usr/b
- 自动配置Google Hosts脚本,googlehosts脚本,#!/usr/bin/e
- 什么值得买签到脚本,值得买签到脚本,#coding=utf-
- 进程监控的python脚本,监控python脚本,NoneSendMail
- Python使用Gmail发邮件,pythongmail发邮件,有时候需要备份
- 原 第三方Linux版网易云音乐 更新 2015-8-10,linux2015-8-1
- tkinter 编写文件字符串替换,tkinter字符串,__author__ =
- python通过ssh-powershell监控windows,,对于服务器的监控来说
- python 线程池,python线程,# !/usr/bin/
- python去除html标签,python去除标签,python去除html
评论关闭