python-下载网页链接

from urllib.request import urlretrieve

url = 'http://images.jupiterimages.com/common/detail/27/68/22986827.jpg'
urlretrieve(url.strip(), './folder1/%s' % (url.strip().split('/')[-1]))

  

strip() 是为了去除字符串头尾的空格

猜你喜欢

转载自www.cnblogs.com/alexYuin/p/9617635.html