Movatterモバイル変換


[0]ホーム

URL:


Wayback Machine
179 captures
08 Oct 2008 - 31 Aug 2025
MarMAYJul
Previous capture16Next capture
201020112012
success
fail
COLLECTED BY
Organization:Alexa Crawls
Starting in 1996,Alexa Internet has been donating their crawl data to the Internet Archive. Flowing in every day, these data are added to theWayback Machine after an embargo period.
Collection:Alexa Crawls
Starting in 1996,Alexa Internet has been donating their crawl data to the Internet Archive. Flowing in every day, these data are added to theWayback Machine after an embargo period.
TIMESTAMPS
loading
The Wayback Machine - https://web.archive.org/web/20110516205728/http://docs.python.org:80/library/glob.html

Navigation

10.7.glob — Unix style pathname pattern expansion

Theglob module finds all the pathnames matching a specified patternaccording to the rules used by the Unix shell. No tilde expansion is done, but*,?, and character ranges expressed with[] will be correctlymatched. This is done by using theos.listdir() andfnmatch.fnmatch() functions in concert, and not by actually invoking asubshell. (For tilde and shell variable expansion, useos.path.expanduser() andos.path.expandvars().)

See also

Latest version of theglob module Python source code

glob.glob(pathname)
Return a possibly-empty list of path names that matchpathname, which must bea string containing a path specification.pathname can be either absolute(like/usr/src/Python-1.5/Makefile) or relative (like../../Tools/*/*.gif), and can contain shell-style wildcards. Brokensymlinks are included in the results (as in the shell).
glob.iglob(pathname)

Return aniterator which yields the same values asglob()without actually storing them all simultaneously.

New in version 2.5.

For example, consider a directory containing only the following files:1.gif,2.txt, andcard.gif.glob() will producethe following results. Notice how any leading components of the path arepreserved.

>>>importglob>>>glob.glob('./[0-9].*')['./1.gif', './2.txt']>>>glob.glob('*.gif')['1.gif', 'card.gif']>>>glob.glob('?.gif')['1.gif']

See also

Modulefnmatch
Shell-style filename (not path) expansion

Previous topic

10.6.tempfile — Generate temporary files and directories

Next topic

10.8.fnmatch — Unix filename pattern matching

This Page

Quick search

Enter search terms or a module, class or function name.

Navigation

©Copyright 1990-2011, Python Software Foundation.
The Python Software Foundation is a non-profit corporation.Please donate.
Last updated on May 16, 2011.Found a bug?
Created usingSphinx 0.6.7.

[8]ページ先頭

©2009-2025 Movatter.jp