python3.3下载固定链接⽂件并保存的⽅法
python 3.3 下载固定链接⽂件并保存。
quest
print ("downloading with urllib")
url = 'www.wzsky/img2013/uploadimg/20130906/1216294.jpg'
f = quest.urlopen(url)
data = f.read()
with open("d:/color/1216294.jpg", "wb") as code:
code.write(data)
urllib在3.3版本有了很⼤变化:
<: ContentTooShortError; HTTPError; URLError
urllib.parse: parse_qs; parse_qsl; quote; quote_from_bytes; quote_plus; unquote
unquote_plus; unquote_to_bytes; urldefrag; urlencode; urljoin; urlparse;
urlsplit; urlunparse; urlunsplit
CatheFTPHandler; FTPHandler; FancyURLopener; FileHandler;
error parse newHTTPBasicAuthHandler; HTTPCookieProcessor; HTTPDefaultErrorHandler;
HTTPDigestAuthHandler; HTTPErrorProcessorl; HTTPHandler;
HTTPPasswordMgr; HTTPPasswordMgrWithDefaultRealm;
HTTPRedirectHandler; HTTPSHandler;OpenerDirector;ProxyBasicAuthHandler
ProxyDigestAuthHandler; ProxyHandler; Request; URLopener;
UnknowHandler; build_opener; getproxies; install_opener; pathname2url;
url2pathname; urlcleanup; urlopen; urlretrieve;
另外,这个⽅法对于有防盗链的链接只能下载到防盗链图⽚。
以上这篇python 3.3 下载固定链接⽂件并保存的⽅法就是⼩编分享给⼤家的全部内容了,希望能给⼤家⼀个参考,也希望⼤家多多⽀持。
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论