• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 555
  • Last Modified:

Download files using python?

Is there a way to have python download and save files from the internet, if I can give it the url?  I would need the steps necessary for both getting the file and saving it somewhere.

Thanks in advance!
1 Solution
Here's how to do it:

import urllib2
input = urllib2.urlopen('http://google.com/')
output = open('google.html', 'wb')

That will download and save an HTML page - the same script will work for a binary file as well.
jonnyz0109Author Commented:
Excellent, thanks!  :o)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now