<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>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                ### 導航 - [索引](../genindex.xhtml "總目錄") - [模塊](../py-modindex.xhtml "Python 模塊索引") | - [下一頁](shutil.xhtml "shutil --- High-level file operations") | - [上一頁](fnmatch.xhtml "fnmatch --- Unix filename pattern matching") | - ![](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); | # [`linecache`](#module-linecache "linecache: This module provides random access to individual lines from text files.") --- Random access to text lines **Source code:** [Lib/linecache.py](https://github.com/python/cpython/tree/3.7/Lib/linecache.py) \[https://github.com/python/cpython/tree/3.7/Lib/linecache.py\] - - - - - - The [`linecache`](#module-linecache "linecache: This module provides random access to individual lines from text files.") module allows one to get any line from a Python source file, while attempting to optimize internally, using a cache, the common case where many lines are read from a single file. This is used by the [`traceback`](traceback.xhtml#module-traceback "traceback: Print or retrieve a stack traceback.") module to retrieve source lines for inclusion in the formatted traceback. The [`tokenize.open()`](tokenize.xhtml#tokenize.open "tokenize.open") function is used to open files. This function uses [`tokenize.detect_encoding()`](tokenize.xhtml#tokenize.detect_encoding "tokenize.detect_encoding") to get the encoding of the file; in the absence of an encoding token, the file encoding defaults to UTF-8. The [`linecache`](#module-linecache "linecache: This module provides random access to individual lines from text files.") module defines the following functions: `linecache.``getline`(*filename*, *lineno*, *module\_globals=None*)Get line *lineno* from file named *filename*. This function will never raise an exception --- it will return `''` on errors (the terminating newline character will be included for lines that are found). If a file named *filename* is not found, the function will look for it in the module search path, `sys.path`, after first checking for a [**PEP 302**](https://www.python.org/dev/peps/pep-0302) \[https://www.python.org/dev/peps/pep-0302\]`__loader__` in *module\_globals*, in case the module was imported from a zipfile or other non-filesystem import source. `linecache.``clearcache`()Clear the cache. Use this function if you no longer need lines from files previously read using [`getline()`](#linecache.getline "linecache.getline"). `linecache.``checkcache`(*filename=None*)Check the cache for validity. Use this function if files in the cache may have changed on disk, and you require the updated version. If *filename* is omitted, it will check all the entries in the cache. `linecache.``lazycache`(*filename*, *module\_globals*)Capture enough detail about a non-file-based module to permit getting its lines later via [`getline()`](#linecache.getline "linecache.getline") even if *module\_globals* is `None` in the later call. This avoids doing I/O until a line is actually needed, without having to carry the module globals around indefinitely. 3\.5 新版功能. 示例: ``` >>> import linecache >>> linecache.getline(linecache.__file__, 8) 'import sys\n' ``` ### 導航 - [索引](../genindex.xhtml "總目錄") - [模塊](../py-modindex.xhtml "Python 模塊索引") | - [下一頁](shutil.xhtml "shutil --- High-level file operations") | - [上一頁](fnmatch.xhtml "fnmatch --- Unix filename pattern matching") | - ![](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>

                              哎呀哎呀视频在线观看