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() 是为了去除字符串头尾的空格
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() 是为了去除字符串头尾的空格