import urllib2
mp3file = urllib2.urlopen("http://www.example.com/songs/mp3.mp3")
with open('test.mp3','wb') as output:
output.write(mp3file.read())
the 'wb'The wb
in open('test.mp3','wb')open('test.mp3','wb')
opens a file (and erases any existing) file, binaraly,) in binary mode so you can save data with it, instead of just text.