What's wrong with this program

Kemp Randy-W18971 Randy.L.Kemp at motorola.com
Wed Jul 4 02:57:54 CEST 2001


Thanks.  I will try that when I get back to work on Thursday. 

-----Original Message-----
From: Bill Bell
To: python-list at cwi.nl
Cc: Kemp Randy-W18971
Sent: 7/3/01 6:04 PM
Subject: RE: What's wrong with this program


Kemp Randy-W18971 <Randy.L.Kemp at motorola.com> wrote, in part:
> Does anyone have an example of how to set filename to access files in
> a directory list, so I can implement this?  My Python is limited, as I
> don't use it every day, and in limited ways.  Thanks. 

import glob
for filename in glob.glob('.\*'):
    print filename

Replace the argument to 'glob' with a string that gives the directory 
you want to list, and the 'print filename' with one or more 
statements making use of 'filename' that do whatever it is that you 
want to do.

Bill

> -----Original Message-----
> From: Oleg Broytmann [mailto:phd at phd.fep.ru]
> Sent: Tuesday, July 03, 2001 3:05 PM
> To: Kemp Randy-W18971
> Cc: 'python-list at python.org'
> Subject: RE: What's wrong with this program
> 
> 
> On Tue, 3 Jul 2001, Kemp Randy-W18971 wrote:
> > Thanks for the correction.
> 
>    Actually I think you don't need ftp.connect() at all - it is called
> in ftp.__init__...
> 
> > Anyone know the correct format to transfer files
> > from one server directory to another server directory?
> 
>    I don't know - I've never used ftplib, but the idea is obvious: put
> it one by one. Something like this:
> 
> for filename in somelist:
>    ftp.storbinary("STOR " + filename, open(filename, 'rb'))
> 
> Oleg.
> ----
>      Oleg Broytmann            http://phd.pp.ru/           





More information about the Python-list mailing list