alny way of not using glob?
Chris Gonnerman
chris.gonnerman at usa.net
Tue Apr 3 09:02:53 EDT 2001
----- Original Message -----
From: <edwardt at trillium.com>
Subject: alny way of not using glob?
> Hi I am trying to get a list of the files in the current direcoty by
> using glob. But I have the following trouble:
> 1. glob is a standard module in python 2.0 but not 1.5.2 whihc I am
> currently using and the sys admin has no intention to upgrade it ...
Actually glob is a standard module in 1.5.2... in fact it appears to be
pure Python, no C code at all. I am attaching glob.py and fnmatch.py
from 1.5.2 for you to try out.
> 2. glob is unix dependent? My script needs to run in windows also ...
Nope. I use it all the time on Windows.
> The code I am using is:
> targetFiles = reduce(operator.add, map(glob.glob, arguments[1:]))
>
> value is arguments[1:] is "*.py"
Actually it's [ *.py" ], that is, a list of one item which is "*.py".
> when I print targetFile, it is:
> ['tp_tc_TNLC01.py', 'tp_tc_TNLC02.py', 'tp_tc_TNLC04.py', 'tp_tc_TNLC0
> 6.py', 'tp_tc_TNLC07.py', 'tp_tc_TNLC08.py', 'tp_tc_TNLC09.py', 'tp_tc
> _TNLC10.py', 'tp_tc_TNLC11.py', 'tp_tc_TNLC14.py', 'tp_tc_TNLC15.py',
> 'tp_tc_TNLC16.py', 'tp_tc_TNLC17.py']
Is this not a correct list of filenames?
> How can I get around that??
What do you want it to do?
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: fnmatch.py
URL: <http://mail.python.org/pipermail/python-list/attachments/20010403/43b8a7ad/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: glob.py
URL: <http://mail.python.org/pipermail/python-list/attachments/20010403/43b8a7ad/attachment-0001.ksh>
More information about the Python-list
mailing list