http - How do I download a file using urllib.request in Python 3? -


so, i'm messing around urllib.request in python 3 , wondering how write result of getting internet file file on local machine. tried this:

g = urllib.request.urlopen('http://media-mcw.cursecdn.com/3/3f/beta.png') open('test.png', 'b+w') f:     f.write(g) 

but got error:

typeerror: 'httpresponse' not support buffer interface 

what doing wrong?

note: have seen this question, it's related python 2's urllib2 overhauled in python 3.

change

f.write(g) 

to

f.write(g.read()) 

Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -