Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #85966
| From | Gregory Ewing <greg.ewing@canterbury.ac.nz> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: What behavior would you expect? |
| Date | 2015-02-21 00:56 +1300 |
| Message-ID | <ckolngFsb91U1@mid.individual.net> (permalink) |
| References | <CANy1k1g+wU6VUifZpV5+DWendT2LqS-PhRA-KC5hmq2xQ_uy+A@mail.gmail.com> <mailman.18907.1424409195.18130.python-list@python.org> |
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
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: What behavior would you expect? Jason Friedman <jsf80238@gmail.com> - 2015-02-19 22:13 -0700 Re: What behavior would you expect? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-02-21 00:56 +1300
csiph-web