What behavior would you expect?
Gregory Ewing
greg.ewing at canterbury.ac.nz
Fri Feb 20 06:56:29 EST 2015
Jason Friedman wrote:
> It's a shame that glob.glob does not take an arbitrary directory as an
> optional argument if one does not want to scan the current directory.
It doesn't have to -- you can give it an absolute path:
>>> from glob import glob
>>> glob("/usr/include/std*.h")
['/usr/include/stdarg.h', '/usr/include/stdbool.h', '/usr/include/stddef.h',
'/usr/include/stdint.h', '/usr/include/stdio.h', '/usr/include/stdlib.h']
So just prepend the dir to the pattern and then
pass it to glob.
--
Greg
More information about the Python-list
mailing list