<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                ### 導航 - [索引](../genindex.xhtml "總目錄") - [模塊](../py-modindex.xhtml "Python 模塊索引") | - [下一頁](fnmatch.xhtml "fnmatch --- Unix filename pattern matching") | - [上一頁](tempfile.xhtml "tempfile --- Generate temporary files and directories") | - ![](https://box.kancloud.cn/a721fc7ec672275e257bbbfde49a4d4e_16x16.png) - [Python](https://www.python.org/) ? - zh\_CN 3.7.3 [文檔](../index.xhtml) ? - [Python 標準庫](index.xhtml) ? - [文件和目錄訪問](filesys.xhtml) ? - $('.inline-search').show(0); | # [`glob`](#module-glob "glob: Unix shell style pathname pattern expansion.") --- Unix style pathname pattern expansion **Source code:** [Lib/glob.py](https://github.com/python/cpython/tree/3.7/Lib/glob.py) \[https://github.com/python/cpython/tree/3.7/Lib/glob.py\] - - - - - - The [`glob`](#module-glob "glob: Unix shell style pathname pattern expansion.") module finds all the pathnames matching a specified pattern according to the rules used by the Unix shell, although results are returned in arbitrary order. No tilde expansion is done, but `*`, `?`, and character ranges expressed with `[]` will be correctly matched. This is done by using the [`os.scandir()`](os.xhtml#os.scandir "os.scandir") and [`fnmatch.fnmatch()`](fnmatch.xhtml#fnmatch.fnmatch "fnmatch.fnmatch") functions in concert, and not by actually invoking a subshell. Note that unlike [`fnmatch.fnmatch()`](fnmatch.xhtml#fnmatch.fnmatch "fnmatch.fnmatch"), [`glob`](#module-glob "glob: Unix shell style pathname pattern expansion.") treats filenames beginning with a dot (`.`) as special cases. (For tilde and shell variable expansion, use [`os.path.expanduser()`](os.path.xhtml#os.path.expanduser "os.path.expanduser") and [`os.path.expandvars()`](os.path.xhtml#os.path.expandvars "os.path.expandvars").) For a literal match, wrap the meta-characters in brackets. For example, `'[?]'` matches the character `'?'`. 參見 The [`pathlib`](pathlib.xhtml#module-pathlib "pathlib: Object-oriented filesystem paths") module offers high-level path objects. `glob.``glob`(*pathname*, *\**, *recursive=False*)Return a possibly-empty list of path names that match *pathname*, which must be a 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. Broken symlinks are included in the results (as in the shell). If *recursive* is true, the pattern "`**`" will match any files and zero or more directories and subdirectories. If the pattern is followed by an `os.sep`, only directories and subdirectories match. 注解 在一個較大的目錄樹中使用 "`**`" 模式可能會消耗非常多的時間。 在 3.5 版更改: Support for recursive globs using "`**`". `glob.``iglob`(*pathname*, *\**, *recursive=False*)Return an [iterator](../glossary.xhtml#term-iterator) which yields the same values as [`glob()`](#module-glob "glob: Unix shell style pathname pattern expansion.")without actually storing them all simultaneously. `glob.``escape`(*pathname*)Escape all special characters (`'?'`, `'*'` and `'['`). This is useful if you want to match an arbitrary literal string that may have special characters in it. Special characters in drive/UNC sharepoints are not escaped, e.g. on Windows `escape('//?/c:/Quo vadis?.txt')` returns `'//?/c:/Quo vadis[?].txt'`. 3\.4 新版功能. For example, consider a directory containing the following files: `1.gif`, `2.txt`, `card.gif` and a subdirectory `sub`which contains only the file `3.txt`. [`glob()`](#module-glob "glob: Unix shell style pathname pattern expansion.") will produce the following results. Notice how any leading components of the path are preserved. ``` >>> import glob >>> glob.glob('./[0-9].*') ['./1.gif', './2.txt'] >>> glob.glob('*.gif') ['1.gif', 'card.gif'] >>> glob.glob('?.gif') ['1.gif'] >>> glob.glob('**/*.txt', recursive=True) ['2.txt', 'sub/3.txt'] >>> glob.glob('./**/', recursive=True) ['./', './sub/'] ``` If the directory contains files starting with `.` they won't be matched by default. For example, consider a directory containing `card.gif` and `.card.gif`: ``` >>> import glob >>> glob.glob('*.gif') ['card.gif'] >>> glob.glob('.c*') ['.card.gif'] ``` 參見 Module [`fnmatch`](fnmatch.xhtml#module-fnmatch "fnmatch: Unix shell style filename pattern matching.")Shell-style filename (not path) expansion ### 導航 - [索引](../genindex.xhtml "總目錄") - [模塊](../py-modindex.xhtml "Python 模塊索引") | - [下一頁](fnmatch.xhtml "fnmatch --- Unix filename pattern matching") | - [上一頁](tempfile.xhtml "tempfile --- Generate temporary files and directories") | - ![](https://box.kancloud.cn/a721fc7ec672275e257bbbfde49a4d4e_16x16.png) - [Python](https://www.python.org/) ? - zh\_CN 3.7.3 [文檔](../index.xhtml) ? - [Python 標準庫](index.xhtml) ? - [文件和目錄訪問](filesys.xhtml) ? - $('.inline-search').show(0); | ? [版權所有](../copyright.xhtml) 2001-2019, Python Software Foundation. Python 軟件基金會是一個非盈利組織。 [請捐助。](https://www.python.org/psf/donations/) 最后更新于 5月 21, 2019. [發現了問題](../bugs.xhtml)? 使用[Sphinx](http://sphinx.pocoo.org/)1.8.4 創建。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看