[Tutor] os.listdir fn

Kent Johnson kent37 at tds.net
Fri Dec 10 19:32:18 CET 2004

Have you looked at the glob module?
 >>> import glob
 >>> glob.glob('src/*.properties')
['src\\jdbc.properties', 'src\\jdbc_local.properties', 'src\\jdbc_qa.properties', 
'src\\jdbc_test.properties', 'src\\log4j.jnlp.properties', 'src\\log4j.properties', 


Nandan wrote:
> Hello
> I need to get the equivalent of 'ls script.icons/*.script'
> I looked around in the os module but can't find anything appropriate.
> That is, filename globbing doesn't seem to work. Looks like I'll have to
> use map/filter to do this.  Is there a better way?
> Thanks,
> N

More information about the Tutor mailing list