[2.5.1] Script to download and rename bunch of files?

G

Gilles Ganault

Hello,

Before I go ahead and learn how to write this, I was wondering if
someone knew of some source code I could use to download and rename a
bunch of files, ie. the equivalent of wget's -O switch?

I would provide a two-column list where column 1 would contain the
full URL, and column 2 would contain the name to use to rename the
file once downloaded.

Thank you.
 
L

Laurent Claessens

Le 08/04/2011 14:47, Gilles Ganault a écrit :
Hello,

Before I go ahead and learn how to write this, I was wondering if
someone knew of some source code I could use to download and rename a
bunch of files, ie. the equivalent of wget's -O switch?

I would provide a two-column list where column 1 would contain the
full URL, and column 2 would contain the name to use to rename the
file once downloaded.

Thank you.

The following puts in the string `a` the code of the page urlBase :

a = urllib.urlopen(urlBase).read()

Then you have to write `a` in a file.

There could be better way.

Laurent
 
G

Gilles Ganault

The following puts in the string `a` the code of the page urlBase :

a = urllib.urlopen(urlBase).read()

Then you have to write `a` in a file.

There could be better way.

Thank you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top