alny way of not using glob?

Remco Gerlich scarblac at pino.selwerd.nl
Tue Apr 3 05:47:19 EDT 2001


edwardt at trillium.com <edwardt at trillium.com> wrote in comp.lang.python:
> 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 ...
> 2. glob is unix dependent? My script needs to run in windows also ...

Glob is also a standard module in 1.5. It is cross platform. So no problem.

> The code I am using is:
> targetFiles = reduce(operator.add, map(glob.glob, arguments[1:]))
> 
> value is arguments[1:] is "*.py"

["*.py"], more likely.

> 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']
> 
> How can I get around that??

Around what? Looks good to me, what did you expect it to be?

-- 
Remco Gerlich



More information about the Python-list mailing list