På 15. jan 2005 kl. 16:16 skrev .removethis.:
>>> import glob
>>> from os.path import isfile
>>> print filter(isfile, glob.glob('/tmp/*')) # can use patterns
Nice example of when filter() is better than list comprehension.
[f for f in glob.glob("/tmp/*") if isfile(fi)]
is a bit too verbose, the ite
On Sat, 15 Jan 2005 15:16:02 GMT, .removethis.
<"(.removethis.)kartic.krishnamurthy"@gmail.com> wrote:
Sara Fwd said the following on 1/15/2005 8:10 AM:
Can you guys also help me find a module that looks in
a directory and print out the names of the files in there?
You can use glob:
>>> import
Sara Fwd said the following on 1/15/2005 8:10 AM:
Can you guys also help me find a module that looks in
a directory and print out the names of the files in there?
You can use glob:
>>> import glob
>>> from os.path import isfile
>>> print filter(isfile, glob.glob('/tmp/*')) # can use patterns
(will
have a look at the glob module
Sara Fwd <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]
01/15/2005 03:10 PM
To
python-list@python.org
cc
Subject
How can I get the names of the files
in a directory?
Can you guys also help me find a module that looks
in
a directory and
Hi,
try the 'listdir' function in the 'os' module. Also check the 'walk'
function.
regards,
Satchit
Satchidanand Haridas (sharidas at zeomega dot com)
ZeOmega (www.zeomega.com)
Open Minds' Open Solutions
#20,Rajalakshmi Plaza,
South End Road,
Basavanagudi,
Bangalore-560 004, India
Sara Fwd
Can you guys also help me find a module that looks in
a directory and print out the names of the files in there?
__
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail
--
http://mail.python.or