判断URL是否支持断点续传?
#python #xiaodeng #判断URL是否支持断点续传? import urllib2 req = urllib2.Request('http://ftp.ubuntu.com/') req.add_header('Range', 'bytes=0-20') res = urllib2.urlopen(req) print res.headers print res.headers['Content-Type']#text/html;charset=UTF-8 #判断该URL是否支持断点续传? #首先由长度,其次有Range便支持断点续传~~ print res.headers['Content-Length']#21 print res.headers['Content-Range']#bytes 0-20/592 ''' Date: Mon, 02 Nov 2015 10:20:42 GMT Server: Apache Vary: Accept-Encoding Content-Range: bytes 0-20/592 Content-Length: 21 Connection: close Content-Type: text/html;charset=UTF-8 '''
无语言基础,自学python所做的各种笔记,欢迎大牛指点.