Python 3.4.3 save image from url to file using urllib

时间:2016-02-12 20:39:46

标签: python urllib

I tried to make a python program that would allow me to download a jpg file from a website.

Why I'm doing this is really for no reason at all, I just wanted to try it for fun.

Anyways, here is the code:

myf = function(){
    document.getElementById('mytext').style.fontSize=document.getElementById('mycontroller').value+"px";
}

(You may have to properly tab it in, it wouldn't let me here)

So basically what I want it to do is to repeatedly download the same file until I close the program. Just don't ask why.

The error code I get is: Traceback (most recent call last): urllib.urlretrieve("http://lemerg.com/data/wallpapers/38/957049.jpg","D:\Users\Elias\Desktop\FolderName-957049.jpg") AttributeError: 'module' object has no attribute 'urlretrieve'

1 个答案:

答案 0 :(得分:2)

$(".selectize").selectize({ create: false, onDropdownOpen: function(dropdown) { var that = $(dropdown).prev().find('.item'); // If the default option is selected, we empty the div acting as input. if(that.data('value') == 'ALL') { that.html(''); } }, onDropdownClose: function(dropdown) { var that = $(dropdown).prev().find('.item'); // If nothing was selected, we restore initial value if(that.data('value') == 'ALL') { that.html('All Manifacturers'); } }, }); in Python3 is in the urlretrieve() module. Do this:

urllib.request