[Tutor] glob.glob(pattern, dir) ?

Lie Ryan lie.1296 at gmail.com
Tue Jun 9 18:12:17 CEST 2009


spir wrote:
> Hello,
> 
> is there a way to make glob work in a specified dir?
> (or is it necessary to use os.chdir first?)
> 
> Thank you,
> denis
> ------
> la vita e estrany
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> 

...
    glob(pathname)
        Return a list of paths matching a pathname pattern.

        The pattern may contain simple shell-style wildcards a la
        fnmatch.
...

>>> glob.glob("/*r*/*/portage")
['/var/tmp/portage', '/var/lib/portage', '/var/log/portage',
'/usr/share/portage', '/usr/X11R6/portage', '/usr/tmp/portage',
'/usr/lib/portage', '/usr/lib64/portage']



More information about the Tutor mailing list