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

Discussion in 'Python' started by Gilles Ganault, Apr 8, 2011.

  1. 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.
    Gilles Ganault, Apr 8, 2011
    #1
    1. Advertising

  2. 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
    Laurent Claessens, Apr 8, 2011
    #2
    1. Advertising

  3. On Fri, 08 Apr 2011 15:14:27 +0200, Laurent Claessens
    <> wrote:
    >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.
    Gilles Ganault, Apr 8, 2011
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nayt Grochowski
    Replies:
    2
    Views:
    568
    Nayt Grochowski
    Dec 3, 2003
  2. Replies:
    2
    Views:
    317
  3. KevinSimonson
    Replies:
    1
    Views:
    523
    John B. Matthews
    Sep 22, 2009
  4. Ed
    Replies:
    8
    Views:
    85
    Eric Pozharski
    Aug 25, 2008
  5. Rider
    Replies:
    6
    Views:
    176
    Charlton Wilbur
    Jul 26, 2009
Loading...

Share This Page