gooderp18绿色标准版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

903 lines
74KB

  1. <!DOCTYPE html>
  2. <html lang="en" data-content_root="../">
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
  6. <meta property="og:title" content="os.path — Common pathname manipulations" />
  7. <meta property="og:type" content="website" />
  8. <meta property="og:url" content="https://docs.python.org/3/library/os.path.html" />
  9. <meta property="og:site_name" content="Python documentation" />
  10. <meta property="og:description" content="Source code: Lib/posixpath.py(for POSIX) and Lib/ntpath.py(for Windows). This module implements some useful functions on pathnames. To read or write files see open(), and for accessing the filesyst..." />
  11. <meta property="og:image" content="https://docs.python.org/3/_static/og-image.png" />
  12. <meta property="og:image:alt" content="Python documentation" />
  13. <meta name="description" content="Source code: Lib/posixpath.py(for POSIX) and Lib/ntpath.py(for Windows). This module implements some useful functions on pathnames. To read or write files see open(), and for accessing the filesyst..." />
  14. <meta property="og:image:width" content="200" />
  15. <meta property="og:image:height" content="200" />
  16. <meta name="theme-color" content="#3776ab" />
  17. <title>os.path — Common pathname manipulations &#8212; Python 3.12.3 documentation</title><meta name="viewport" content="width=device-width, initial-scale=1.0">
  18. <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=80d5e7a1" />
  19. <link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css?v=bb723527" />
  20. <link id="pygments_dark_css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css" href="../_static/pygments_dark.css?v=b20cc3f5" />
  21. <script src="../_static/documentation_options.js?v=2c828074"></script>
  22. <script src="../_static/doctools.js?v=888ff710"></script>
  23. <script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
  24. <script src="../_static/sidebar.js"></script>
  25. <link rel="search" type="application/opensearchdescription+xml"
  26. title="Search within Python 3.12.3 documentation"
  27. href="../_static/opensearch.xml"/>
  28. <link rel="author" title="About these documents" href="../about.html" />
  29. <link rel="index" title="Index" href="../genindex.html" />
  30. <link rel="search" title="Search" href="../search.html" />
  31. <link rel="copyright" title="Copyright" href="../copyright.html" />
  32. <link rel="next" title="fileinput — Iterate over lines from multiple input streams" href="fileinput.html" />
  33. <link rel="prev" title="pathlib — Object-oriented filesystem paths" href="pathlib.html" />
  34. <link rel="canonical" href="https://docs.python.org/3/library/os.path.html" />
  35. <style>
  36. @media only screen {
  37. table.full-width-table {
  38. width: 100%;
  39. }
  40. }
  41. </style>
  42. <link rel="stylesheet" href="../_static/pydoctheme_dark.css" media="(prefers-color-scheme: dark)" id="pydoctheme_dark_css">
  43. <link rel="shortcut icon" type="image/png" href="../_static/py.svg" />
  44. <script type="text/javascript" src="../_static/copybutton.js"></script>
  45. <script type="text/javascript" src="../_static/menu.js"></script>
  46. <script type="text/javascript" src="../_static/search-focus.js"></script>
  47. <script type="text/javascript" src="../_static/themetoggle.js"></script>
  48. </head>
  49. <body>
  50. <div class="mobile-nav">
  51. <input type="checkbox" id="menuToggler" class="toggler__input" aria-controls="navigation"
  52. aria-pressed="false" aria-expanded="false" role="button" aria-label="Menu" />
  53. <nav class="nav-content" role="navigation">
  54. <label for="menuToggler" class="toggler__label">
  55. <span></span>
  56. </label>
  57. <span class="nav-items-wrapper">
  58. <a href="https://www.python.org/" class="nav-logo">
  59. <img src="../_static/py.svg" alt="Python logo"/>
  60. </a>
  61. <span class="version_switcher_placeholder"></span>
  62. <form role="search" class="search" action="../search.html" method="get">
  63. <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" class="search-icon">
  64. <path fill-rule="nonzero" fill="currentColor" d="M15.5 14h-.79l-.28-.27a6.5 6.5 0 001.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 00-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.5 6.5 0 005.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path>
  65. </svg>
  66. <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" />
  67. <input type="submit" value="Go"/>
  68. </form>
  69. </span>
  70. </nav>
  71. <div class="menu-wrapper">
  72. <nav class="menu" role="navigation" aria-label="main navigation">
  73. <div class="language_switcher_placeholder"></div>
  74. <label class="theme-selector-label">
  75. Theme
  76. <select class="theme-selector" oninput="activateTheme(this.value)">
  77. <option value="auto" selected>Auto</option>
  78. <option value="light">Light</option>
  79. <option value="dark">Dark</option>
  80. </select>
  81. </label>
  82. <div>
  83. <h4>Previous topic</h4>
  84. <p class="topless"><a href="pathlib.html"
  85. title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pathlib</span></code> — Object-oriented filesystem paths</a></p>
  86. </div>
  87. <div>
  88. <h4>Next topic</h4>
  89. <p class="topless"><a href="fileinput.html"
  90. title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">fileinput</span></code> — Iterate over lines from multiple input streams</a></p>
  91. </div>
  92. <div role="note" aria-label="source link">
  93. <h3>This Page</h3>
  94. <ul class="this-page-menu">
  95. <li><a href="../bugs.html">Report a Bug</a></li>
  96. <li>
  97. <a href="https://github.com/python/cpython/blob/main/Doc/library/os.path.rst"
  98. rel="nofollow">Show Source
  99. </a>
  100. </li>
  101. </ul>
  102. </div>
  103. </nav>
  104. </div>
  105. </div>
  106. <div class="related" role="navigation" aria-label="related navigation">
  107. <h3>Navigation</h3>
  108. <ul>
  109. <li class="right" style="margin-right: 10px">
  110. <a href="../genindex.html" title="General Index"
  111. accesskey="I">index</a></li>
  112. <li class="right" >
  113. <a href="../py-modindex.html" title="Python Module Index"
  114. >modules</a> |</li>
  115. <li class="right" >
  116. <a href="fileinput.html" title="fileinput — Iterate over lines from multiple input streams"
  117. accesskey="N">next</a> |</li>
  118. <li class="right" >
  119. <a href="pathlib.html" title="pathlib — Object-oriented filesystem paths"
  120. accesskey="P">previous</a> |</li>
  121. <li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
  122. <li><a href="https://www.python.org/">Python</a> &#187;</li>
  123. <li class="switchers">
  124. <div class="language_switcher_placeholder"></div>
  125. <div class="version_switcher_placeholder"></div>
  126. </li>
  127. <li>
  128. </li>
  129. <li id="cpython-language-and-version">
  130. <a href="../index.html">3.12.3 Documentation</a> &#187;
  131. </li>
  132. <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>
  133. <li class="nav-item nav-item-2"><a href="filesys.html" accesskey="U">File and Directory Access</a> &#187;</li>
  134. <li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">os.path</span></code> — Common pathname manipulations</a></li>
  135. <li class="right">
  136. <div class="inline-search" role="search">
  137. <form class="inline-search" action="../search.html" method="get">
  138. <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
  139. <input type="submit" value="Go" />
  140. </form>
  141. </div>
  142. |
  143. </li>
  144. <li class="right">
  145. <label class="theme-selector-label">
  146. Theme
  147. <select class="theme-selector" oninput="activateTheme(this.value)">
  148. <option value="auto" selected>Auto</option>
  149. <option value="light">Light</option>
  150. <option value="dark">Dark</option>
  151. </select>
  152. </label> |</li>
  153. </ul>
  154. </div>
  155. <div class="document">
  156. <div class="documentwrapper">
  157. <div class="bodywrapper">
  158. <div class="body" role="main">
  159. <section id="module-os.path">
  160. <span id="os-path-common-pathname-manipulations"></span><h1><a class="reference internal" href="#module-os.path" title="os.path: Operations on pathnames."><code class="xref py py-mod docutils literal notranslate"><span class="pre">os.path</span></code></a> — Common pathname manipulations<a class="headerlink" href="#module-os.path" title="Link to this heading">¶</a></h1>
  161. <p><strong>Source code:</strong> <a class="reference external" href="https://github.com/python/cpython/tree/3.12/Lib/posixpath.py">Lib/posixpath.py</a> (for POSIX) and
  162. <a class="reference external" href="https://github.com/python/cpython/tree/3.12/Lib/ntpath.py">Lib/ntpath.py</a> (for Windows).</p>
  163. <hr class="docutils" id="index-0" />
  164. <p>This module implements some useful functions on pathnames. To read or write
  165. files see <a class="reference internal" href="functions.html#open" title="open"><code class="xref py py-func docutils literal notranslate"><span class="pre">open()</span></code></a>, and for accessing the filesystem see the <a class="reference internal" href="os.html#module-os" title="os: Miscellaneous operating system interfaces."><code class="xref py py-mod docutils literal notranslate"><span class="pre">os</span></code></a>
  166. module. The path parameters can be passed as strings, or bytes, or any object
  167. implementing the <a class="reference internal" href="os.html#os.PathLike" title="os.PathLike"><code class="xref py py-class docutils literal notranslate"><span class="pre">os.PathLike</span></code></a> protocol.</p>
  168. <p>Unlike a Unix shell, Python does not do any <em>automatic</em> path expansions.
  169. Functions such as <a class="reference internal" href="#os.path.expanduser" title="os.path.expanduser"><code class="xref py py-func docutils literal notranslate"><span class="pre">expanduser()</span></code></a> and <a class="reference internal" href="#os.path.expandvars" title="os.path.expandvars"><code class="xref py py-func docutils literal notranslate"><span class="pre">expandvars()</span></code></a> can be invoked
  170. explicitly when an application desires shell-like path expansion. (See also
  171. the <a class="reference internal" href="glob.html#module-glob" title="glob: Unix shell style pathname pattern expansion."><code class="xref py py-mod docutils literal notranslate"><span class="pre">glob</span></code></a> module.)</p>
  172. <div class="admonition seealso">
  173. <p class="admonition-title">See also</p>
  174. <p>The <a class="reference internal" href="pathlib.html#module-pathlib" title="pathlib: Object-oriented filesystem paths"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pathlib</span></code></a> module offers high-level path objects.</p>
  175. </div>
  176. <div class="admonition note">
  177. <p class="admonition-title">Note</p>
  178. <p>All of these functions accept either only bytes or only string objects as
  179. their parameters. The result is an object of the same type, if a path or
  180. file name is returned.</p>
  181. </div>
  182. <div class="admonition note">
  183. <p class="admonition-title">Note</p>
  184. <p>Since different operating systems have different path name conventions, there
  185. are several versions of this module in the standard library. The
  186. <a class="reference internal" href="#module-os.path" title="os.path: Operations on pathnames."><code class="xref py py-mod docutils literal notranslate"><span class="pre">os.path</span></code></a> module is always the path module suitable for the operating
  187. system Python is running on, and therefore usable for local paths. However,
  188. you can also import and use the individual modules if you want to manipulate
  189. a path that is <em>always</em> in one of the different formats. They all have the
  190. same interface:</p>
  191. <ul class="simple">
  192. <li><p><code class="xref py py-mod docutils literal notranslate"><span class="pre">posixpath</span></code> for UNIX-style paths</p></li>
  193. <li><p><code class="xref py py-mod docutils literal notranslate"><span class="pre">ntpath</span></code> for Windows paths</p></li>
  194. </ul>
  195. </div>
  196. <div class="versionchanged">
  197. <p><span class="versionmodified changed">Changed in version 3.8: </span><a class="reference internal" href="#os.path.exists" title="os.path.exists"><code class="xref py py-func docutils literal notranslate"><span class="pre">exists()</span></code></a>, <a class="reference internal" href="#os.path.lexists" title="os.path.lexists"><code class="xref py py-func docutils literal notranslate"><span class="pre">lexists()</span></code></a>, <a class="reference internal" href="#os.path.isdir" title="os.path.isdir"><code class="xref py py-func docutils literal notranslate"><span class="pre">isdir()</span></code></a>, <a class="reference internal" href="#os.path.isfile" title="os.path.isfile"><code class="xref py py-func docutils literal notranslate"><span class="pre">isfile()</span></code></a>,
  198. <a class="reference internal" href="#os.path.islink" title="os.path.islink"><code class="xref py py-func docutils literal notranslate"><span class="pre">islink()</span></code></a>, and <a class="reference internal" href="#os.path.ismount" title="os.path.ismount"><code class="xref py py-func docutils literal notranslate"><span class="pre">ismount()</span></code></a> now return <code class="docutils literal notranslate"><span class="pre">False</span></code> instead of
  199. raising an exception for paths that contain characters or bytes
  200. unrepresentable at the OS level.</p>
  201. </div>
  202. <dl class="py function">
  203. <dt class="sig sig-object py" id="os.path.abspath">
  204. <span class="sig-prename descclassname"><span class="pre">os.path.</span></span><span class="sig-name descname"><span class="pre">abspath</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#os.path.abspath" title="Link to this definition">¶</a></dt>
  205. <dd><p>Return a normalized absolutized version of the pathname <em>path</em>. On most
  206. platforms, this is equivalent to calling the function <a class="reference internal" href="#os.path.normpath" title="os.path.normpath"><code class="xref py py-func docutils literal notranslate"><span class="pre">normpath()</span></code></a> as
  207. follows: <code class="docutils literal notranslate"><span class="pre">normpath(join(os.getcwd(),</span> <span class="pre">path))</span></code>.</p>
  208. <div class="versionchanged">
  209. <p><span class="versionmodified changed">Changed in version 3.6: </span>Accepts a <a class="reference internal" href="../glossary.html#term-path-like-object"><span class="xref std std-term">path-like object</span></a>.</p>
  210. </div>
  211. </dd></dl>
  212. <dl class="py function">
  213. <dt class="sig sig-object py" id="os.path.basename">
  214. <span class="sig-prename descclassname"><span class="pre">os.path.</span></span><span class="sig-name descname"><span class="pre">basename</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#os.path.basename" title="Link to this definition">¶</a></dt>
  215. <dd><p>Return the base name of pathname <em>path</em>. This is the second element of the
  216. pair returned by passing <em>path</em> to the function <a class="reference internal" href="#os.path.split" title="os.path.split"><code class="xref py py-func docutils literal notranslate"><span class="pre">split()</span></code></a>. Note that
  217. the result of this function is different
  218. from the Unix <strong class="program">basename</strong> program; where <strong class="program">basename</strong> for
  219. <code class="docutils literal notranslate"><span class="pre">'/foo/bar/'</span></code> returns <code class="docutils literal notranslate"><span class="pre">'bar'</span></code>, the <a class="reference internal" href="#os.path.basename" title="os.path.basename"><code class="xref py py-func docutils literal notranslate"><span class="pre">basename()</span></code></a> function returns an
  220. empty string (<code class="docutils literal notranslate"><span class="pre">''</span></code>).</p>
  221. <div class="versionchanged">
  222. <p><span class="versionmodified changed">Changed in version 3.6: </span>Accepts a <a class="reference internal" href="../glossary.html#term-path-like-object"><span class="xref std std-term">path-like object</span></a>.</p>
  223. </div>
  224. </dd></dl>
  225. <dl class="py function">
  226. <dt class="sig sig-object py" id="os.path.commonpath">
  227. <span class="sig-prename descclassname"><span class="pre">os.path.</span></span><span class="sig-name descname"><span class="pre">commonpath</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">paths</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#os.path.commonpath" title="Link to this definition">¶</a></dt>
  228. <dd><p>Return the longest common sub-path of each pathname in the sequence
  229. <em>paths</em>. Raise <a class="reference internal" href="exceptions.html#ValueError" title="ValueError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code></a> if <em>paths</em> contain both absolute
  230. and relative pathnames, the <em>paths</em> are on the different drives or
  231. if <em>paths</em> is empty. Unlike <a class="reference internal" href="#os.path.commonprefix" title="os.path.commonprefix"><code class="xref py py-func docutils literal notranslate"><span class="pre">commonprefix()</span></code></a>, this returns a
  232. valid path.</p>
  233. <div class="availability docutils container">
  234. <p><a class="reference internal" href="intro.html#availability"><span class="std std-ref">Availability</span></a>: Unix, Windows.</p>
  235. </div>
  236. <div class="versionadded">
  237. <p><span class="versionmodified added">New in version 3.5.</span></p>
  238. </div>
  239. <div class="versionchanged">
  240. <p><span class="versionmodified changed">Changed in version 3.6: </span>Accepts a sequence of <a class="reference internal" href="../glossary.html#term-path-like-object"><span class="xref std std-term">path-like objects</span></a>.</p>
  241. </div>
  242. </dd></dl>
  243. <dl class="py function">
  244. <dt class="sig sig-object py" id="os.path.commonprefix">
  245. <span class="sig-prename descclassname"><span class="pre">os.path.</span></span><span class="sig-name descname"><span class="pre">commonprefix</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">list</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#os.path.commonprefix" title="Link to this definition">¶</a></dt>
  246. <dd><p>Return the longest path prefix (taken character-by-character) that is a
  247. prefix of all paths in <em>list</em>. If <em>list</em> is empty, return the empty string
  248. (<code class="docutils literal notranslate"><span class="pre">''</span></code>).</p>
  249. <div class="admonition note">
  250. <p class="admonition-title">Note</p>
  251. <p>This function may return invalid paths because it works a
  252. character at a time. To obtain a valid path, see
  253. <a class="reference internal" href="#os.path.commonpath" title="os.path.commonpath"><code class="xref py py-func docutils literal notranslate"><span class="pre">commonpath()</span></code></a>.</p>
  254. <div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">commonprefix</span><span class="p">([</span><span class="s1">&#39;/usr/lib&#39;</span><span class="p">,</span> <span class="s1">&#39;/usr/local/lib&#39;</span><span class="p">])</span>
  255. <span class="go">&#39;/usr/l&#39;</span>
  256. <span class="gp">&gt;&gt;&gt; </span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">commonpath</span><span class="p">([</span><span class="s1">&#39;/usr/lib&#39;</span><span class="p">,</span> <span class="s1">&#39;/usr/local/lib&#39;</span><span class="p">])</span>
  257. <span class="go">&#39;/usr&#39;</span>
  258. </pre></div>
  259. </div>
  260. </div>
  261. <div class="versionchanged">
  262. <p><span class="versionmodified changed">Changed in version 3.6: </span>Accepts a <a class="reference internal" href="../glossary.html#term-path-like-object"><span class="xref std std-term">path-like object</span></a>.</p>
  263. </div>
  264. </dd></dl>
  265. <dl class="py function">
  266. <dt class="sig sig-object py" id="os.path.dirname">
  267. <span class="sig-prename descclassname"><span class="pre">os.path.</span></span><span class="sig-name descname"><span class="pre">dirname</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#os.path.dirname" title="Link to this definition">¶</a></dt>
  268. <dd><p>Return the directory name of pathname <em>path</em>. This is the first element of
  269. the pair returned by passing <em>path</em> to the function <a class="reference internal" href="#os.path.split" title="os.path.split"><code class="xref py py-func docutils literal notranslate"><span class="pre">split()</span></code></a>.</p>
  270. <div class="versionchanged">
  271. <p><span class="versionmodified changed">Changed in version 3.6: </span>Accepts a <a class="reference internal" href="../glossary.html#term-path-like-object"><span class="xref std std-term">path-like object</span></a>.</p>
  272. </div>
  273. </dd></dl>
  274. <dl class="py function">
  275. <dt class="sig sig-object py" id="os.path.exists">
  276. <span class="sig-prename descclassname"><span class="pre">os.path.</span></span><span class="sig-name descname"><span class="pre">exists</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#os.path.exists" title="Link to this definition">¶</a></dt>
  277. <dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if <em>path</em> refers to an existing path or an open
  278. file descriptor. Returns <code class="docutils literal notranslate"><span class="pre">False</span></code> for broken symbolic links. On
  279. some platforms, this function may return <code class="docutils literal notranslate"><span class="pre">False</span></code> if permission is
  280. not granted to execute <a class="reference internal" href="os.html#os.stat" title="os.stat"><code class="xref py py-func docutils literal notranslate"><span class="pre">os.stat()</span></code></a> on the requested file, even
  281. if the <em>path</em> physically exists.</p>
  282. <div class="versionchanged">
  283. <p><span class="versionmodified changed">Changed in version 3.3: </span><em>path</em> can now be an integer: <code class="docutils literal notranslate"><span class="pre">True</span></code> is returned if it is an
  284. open file descriptor, <code class="docutils literal notranslate"><span class="pre">False</span></code> otherwise.</p>
  285. </div>
  286. <div class="versionchanged">
  287. <p><span class="versionmodified changed">Changed in version 3.6: </span>Accepts a <a class="reference internal" href="../glossary.html#term-path-like-object"><span class="xref std std-term">path-like object</span></a>.</p>
  288. </div>
  289. </dd></dl>
  290. <dl class="py function">
  291. <dt class="sig sig-object py" id="os.path.lexists">
  292. <span class="sig-prename descclassname"><span class="pre">os.path.</span></span><span class="sig-name descname"><span class="pre">lexists</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#os.path.lexists" title="Link to this definition">¶</a></dt>
  293. <dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if <em>path</em> refers to an existing path. Returns <code class="docutils literal notranslate"><span class="pre">True</span></code> for
  294. broken symbolic links. Equivalent to <a class="reference internal" href="#os.path.exists" title="os.path.exists"><code class="xref py py-func docutils literal notranslate"><span class="pre">exists()</span></code></a> on platforms lacking
  295. <a class="reference internal" href="os.html#os.lstat" title="os.lstat"><code class="xref py py-func docutils literal notranslate"><span class="pre">os.lstat()</span></code></a>.</p>
  296. <div class="versionchanged">
  297. <p><span class="versionmodified changed">Changed in version 3.6: </span>Accepts a <a class="reference internal" href="../glossary.html#term-path-like-object"><span class="xref std std-term">path-like object</span></a>.</p>
  298. </div>
  299. </dd></dl>
  300. <dl class="py function" id="index-1">
  301. <dt class="sig sig-object py" id="os.path.expanduser">
  302. <span class="sig-prename descclassname"><span class="pre">os.path.</span></span><span class="sig-name descname"><span class="pre">expanduser</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#os.path.expanduser" title="Link to this definition">¶</a></dt>
  303. <dd><p>On Unix and Windows, return the argument with an initial component of <code class="docutils literal notranslate"><span class="pre">~</span></code> or
  304. <code class="docutils literal notranslate"><span class="pre">~user</span></code> replaced by that <em>user</em>’s home directory.</p>
  305. <p id="index-2">On Unix, an initial <code class="docutils literal notranslate"><span class="pre">~</span></code> is replaced by the environment variable <span class="target" id="index-3"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">HOME</span></code>
  306. if it is set; otherwise the current user’s home directory is looked up in the
  307. password directory through the built-in module <a class="reference internal" href="pwd.html#module-pwd" title="pwd: The password database (getpwnam() and friends). (Unix)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pwd</span></code></a>. An initial <code class="docutils literal notranslate"><span class="pre">~user</span></code>
  308. is looked up directly in the password directory.</p>
  309. <p>On Windows, <span class="target" id="index-4"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">USERPROFILE</span></code> will be used if set, otherwise a combination
  310. of <span class="target" id="index-5"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">HOMEPATH</span></code> and <span class="target" id="index-6"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">HOMEDRIVE</span></code> will be used. An initial
  311. <code class="docutils literal notranslate"><span class="pre">~user</span></code> is handled by checking that the last directory component of the current
  312. user’s home directory matches <span class="target" id="index-7"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">USERNAME</span></code>, and replacing it if so.</p>
  313. <p>If the expansion fails or if the path does not begin with a tilde, the path is
  314. returned unchanged.</p>
  315. <div class="versionchanged">
  316. <p><span class="versionmodified changed">Changed in version 3.6: </span>Accepts a <a class="reference internal" href="../glossary.html#term-path-like-object"><span class="xref std std-term">path-like object</span></a>.</p>
  317. </div>
  318. <div class="versionchanged">
  319. <p><span class="versionmodified changed">Changed in version 3.8: </span>No longer uses <span class="target" id="index-8"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">HOME</span></code> on Windows.</p>
  320. </div>
  321. </dd></dl>
  322. <dl class="py function" id="index-9">
  323. <dt class="sig sig-object py" id="os.path.expandvars">
  324. <span class="sig-prename descclassname"><span class="pre">os.path.</span></span><span class="sig-name descname"><span class="pre">expandvars</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#os.path.expandvars" title="Link to this definition">¶</a></dt>
  325. <dd><p>Return the argument with environment variables expanded. Substrings of the form
  326. <code class="docutils literal notranslate"><span class="pre">$name</span></code> or <code class="docutils literal notranslate"><span class="pre">${name}</span></code> are replaced by the value of environment variable
  327. <em>name</em>. Malformed variable names and references to non-existing variables are
  328. left unchanged.</p>
  329. <p>On Windows, <code class="docutils literal notranslate"><span class="pre">%name%</span></code> expansions are supported in addition to <code class="docutils literal notranslate"><span class="pre">$name</span></code> and
  330. <code class="docutils literal notranslate"><span class="pre">${name}</span></code>.</p>
  331. <div class="versionchanged">
  332. <p><span class="versionmodified changed">Changed in version 3.6: </span>Accepts a <a class="reference internal" href="../glossary.html#term-path-like-object"><span class="xref std std-term">path-like object</span></a>.</p>
  333. </div>
  334. </dd></dl>
  335. <dl class="py function">
  336. <dt class="sig sig-object py" id="os.path.getatime">
  337. <span class="sig-prename descclassname"><span class="pre">os.path.</span></span><span class="sig-name descname"><span class="pre">getatime</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#os.path.getatime" title="Link to this definition">¶</a></dt>
  338. <dd><p>Return the time of last access of <em>path</em>. The return value is a floating point number giving
  339. the number of seconds since the epoch (see the <a class="reference internal" href="time.html#module-time" title="time: Time access and conversions."><code class="xref py py-mod docutils literal notranslate"><span class="pre">time</span></code></a> module). Raise
  340. <a class="reference internal" href="exceptions.html#OSError" title="OSError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">OSError</span></code></a> if the file does not exist or is inaccessible.</p>
  341. </dd></dl>
  342. <dl class="py function">
  343. <dt class="sig sig-object py" id="os.path.getmtime">
  344. <span class="sig-prename descclassname"><span class="pre">os.path.</span></span><span class="sig-name descname"><span class="pre">getmtime</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#os.path.getmtime" title="Link to this definition">¶</a></dt>
  345. <dd><p>Return the time of last modification of <em>path</em>. The return value is a floating point number
  346. giving the number of seconds since the epoch (see the <a class="reference internal" href="time.html#module-time" title="time: Time access and conversions."><code class="xref py py-mod docutils literal notranslate"><span class="pre">time</span></code></a> module).
  347. Raise <a class="reference internal" href="exceptions.html#OSError" title="OSError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">OSError</span></code></a> if the file does not exist or is inaccessible.</p>
  348. <div class="versionchanged">
  349. <p><span class="versionmodified changed">Changed in version 3.6: </span>Accepts a <a class="reference internal" href="../glossary.html#term-path-like-object"><span class="xref std std-term">path-like object</span></a>.</p>
  350. </div>
  351. </dd></dl>
  352. <dl class="py function">
  353. <dt class="sig sig-object py" id="os.path.getctime">
  354. <span class="sig-prename descclassname"><span class="pre">os.path.</span></span><span class="sig-name descname"><span class="pre">getctime</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#os.path.getctime" title="Link to this definition">¶</a></dt>
  355. <dd><p>Return the system’s ctime which, on some systems (like Unix) is the time of the
  356. last metadata change, and, on others (like Windows), is the creation time for <em>path</em>.
  357. The return value is a number giving the number of seconds since the epoch (see
  358. the <a class="reference internal" href="time.html#module-time" title="time: Time access and conversions."><code class="xref py py-mod docutils literal notranslate"><span class="pre">time</span></code></a> module). Raise <a class="reference internal" href="exceptions.html#OSError" title="OSError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">OSError</span></code></a> if the file does not exist or
  359. is inaccessible.</p>
  360. <div class="versionchanged">
  361. <p><span class="versionmodified changed">Changed in version 3.6: </span>Accepts a <a class="reference internal" href="../glossary.html#term-path-like-object"><span class="xref std std-term">path-like object</span></a>.</p>
  362. </div>
  363. </dd></dl>
  364. <dl class="py function">
  365. <dt class="sig sig-object py" id="os.path.getsize">
  366. <span class="sig-prename descclassname"><span class="pre">os.path.</span></span><span class="sig-name descname"><span class="pre">getsize</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#os.path.getsize" title="Link to this definition">¶</a></dt>
  367. <dd><p>Return the size, in bytes, of <em>path</em>. Raise <a class="reference internal" href="exceptions.html#OSError" title="OSError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">OSError</span></code></a> if the file does
  368. not exist or is inaccessible.</p>
  369. <div class="versionchanged">
  370. <p><span class="versionmodified changed">Changed in version 3.6: </span>Accepts a <a class="reference internal" href="../glossary.html#term-path-like-object"><span class="xref std std-term">path-like object</span></a>.</p>
  371. </div>
  372. </dd></dl>
  373. <dl class="py function">
  374. <dt class="sig sig-object py" id="os.path.isabs">
  375. <span class="sig-prename descclassname"><span class="pre">os.path.</span></span><span class="sig-name descname"><span class="pre">isabs</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#os.path.isabs" title="Link to this definition">¶</a></dt>
  376. <dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if <em>path</em> is an absolute pathname. On Unix, that means it
  377. begins with a slash, on Windows that it begins with a (back)slash after chopping
  378. off a potential drive letter.</p>
  379. <div class="versionchanged">
  380. <p><span class="versionmodified changed">Changed in version 3.6: </span>Accepts a <a class="reference internal" href="../glossary.html#term-path-like-object"><span class="xref std std-term">path-like object</span></a>.</p>
  381. </div>
  382. </dd></dl>
  383. <dl class="py function">
  384. <dt class="sig sig-object py" id="os.path.isfile">
  385. <span class="sig-prename descclassname"><span class="pre">os.path.</span></span><span class="sig-name descname"><span class="pre">isfile</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#os.path.isfile" title="Link to this definition">¶</a></dt>
  386. <dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if <em>path</em> is an <a class="reference internal" href="#os.path.exists" title="os.path.exists"><code class="xref py py-func docutils literal notranslate"><span class="pre">existing</span></code></a> regular file.
  387. This follows symbolic links, so both <a class="reference internal" href="#os.path.islink" title="os.path.islink"><code class="xref py py-func docutils literal notranslate"><span class="pre">islink()</span></code></a> and <a class="reference internal" href="#os.path.isfile" title="os.path.isfile"><code class="xref py py-func docutils literal notranslate"><span class="pre">isfile()</span></code></a> can
  388. be true for the same path.</p>
  389. <div class="versionchanged">
  390. <p><span class="versionmodified changed">Changed in version 3.6: </span>Accepts a <a class="reference internal" href="../glossary.html#term-path-like-object"><span class="xref std std-term">path-like object</span></a>.</p>
  391. </div>
  392. </dd></dl>
  393. <dl class="py function">
  394. <dt class="sig sig-object py" id="os.path.isdir">
  395. <span class="sig-prename descclassname"><span class="pre">os.path.</span></span><span class="sig-name descname"><span class="pre">isdir</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#os.path.isdir" title="Link to this definition">¶</a></dt>
  396. <dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if <em>path</em> is an <a class="reference internal" href="#os.path.exists" title="os.path.exists"><code class="xref py py-func docutils literal notranslate"><span class="pre">existing</span></code></a> directory. This
  397. follows symbolic links, so both <a class="reference internal" href="#os.path.islink" title="os.path.islink"><code class="xref py py-func docutils literal notranslate"><span class="pre">islink()</span></code></a> and <a class="reference internal" href="#os.path.isdir" title="os.path.isdir"><code class="xref py py-func docutils literal notranslate"><span class="pre">isdir()</span></code></a> can be true
  398. for the same path.</p>
  399. <div class="versionchanged">
  400. <p><span class="versionmodified changed">Changed in version 3.6: </span>Accepts a <a class="reference internal" href="../glossary.html#term-path-like-object"><span class="xref std std-term">path-like object</span></a>.</p>
  401. </div>
  402. </dd></dl>
  403. <dl class="py function">
  404. <dt class="sig sig-object py" id="os.path.isjunction">
  405. <span class="sig-prename descclassname"><span class="pre">os.path.</span></span><span class="sig-name descname"><span class="pre">isjunction</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#os.path.isjunction" title="Link to this definition">¶</a></dt>
  406. <dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if <em>path</em> refers to an <a class="reference internal" href="#os.path.lexists" title="os.path.lexists"><code class="xref py py-func docutils literal notranslate"><span class="pre">existing</span></code></a> directory
  407. entry that is a junction. Always return <code class="docutils literal notranslate"><span class="pre">False</span></code> if junctions are not
  408. supported on the current platform.</p>
  409. <div class="versionadded">
  410. <p><span class="versionmodified added">New in version 3.12.</span></p>
  411. </div>
  412. </dd></dl>
  413. <dl class="py function">
  414. <dt class="sig sig-object py" id="os.path.islink">
  415. <span class="sig-prename descclassname"><span class="pre">os.path.</span></span><span class="sig-name descname"><span class="pre">islink</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#os.path.islink" title="Link to this definition">¶</a></dt>
  416. <dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if <em>path</em> refers to an <a class="reference internal" href="#os.path.exists" title="os.path.exists"><code class="xref py py-func docutils literal notranslate"><span class="pre">existing</span></code></a> directory
  417. entry that is a symbolic link. Always <code class="docutils literal notranslate"><span class="pre">False</span></code> if symbolic links are not
  418. supported by the Python runtime.</p>
  419. <div class="versionchanged">
  420. <p><span class="versionmodified changed">Changed in version 3.6: </span>Accepts a <a class="reference internal" href="../glossary.html#term-path-like-object"><span class="xref std std-term">path-like object</span></a>.</p>
  421. </div>
  422. </dd></dl>
  423. <dl class="py function">
  424. <dt class="sig sig-object py" id="os.path.ismount">
  425. <span class="sig-prename descclassname"><span class="pre">os.path.</span></span><span class="sig-name descname"><span class="pre">ismount</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#os.path.ismount" title="Link to this definition">¶</a></dt>
  426. <dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if pathname <em>path</em> is a <em class="dfn">mount point</em>: a point in a
  427. file system where a different file system has been mounted. On POSIX, the
  428. function checks whether <em>path</em>’s parent, <code class="file docutils literal notranslate"><em><span class="pre">path</span></em><span class="pre">/..</span></code>, is on a different
  429. device than <em>path</em>, or whether <code class="file docutils literal notranslate"><em><span class="pre">path</span></em><span class="pre">/..</span></code> and <em>path</em> point to the same
  430. i-node on the same device — this should detect mount points for all Unix
  431. and POSIX variants. It is not able to reliably detect bind mounts on the
  432. same filesystem. On Windows, a drive letter root and a share UNC are
  433. always mount points, and for any other path <code class="docutils literal notranslate"><span class="pre">GetVolumePathName</span></code> is called
  434. to see if it is different from the input path.</p>
  435. <div class="versionadded">
  436. <p><span class="versionmodified added">New in version 3.4: </span>Support for detecting non-root mount points on Windows.</p>
  437. </div>
  438. <div class="versionchanged">
  439. <p><span class="versionmodified changed">Changed in version 3.6: </span>Accepts a <a class="reference internal" href="../glossary.html#term-path-like-object"><span class="xref std std-term">path-like object</span></a>.</p>
  440. </div>
  441. </dd></dl>
  442. <dl class="py function">
  443. <dt class="sig sig-object py" id="os.path.isdevdrive">
  444. <span class="sig-prename descclassname"><span class="pre">os.path.</span></span><span class="sig-name descname"><span class="pre">isdevdrive</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#os.path.isdevdrive" title="Link to this definition">¶</a></dt>
  445. <dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if pathname <em>path</em> is located on a Windows Dev Drive.
  446. A Dev Drive is optimized for developer scenarios, and offers faster
  447. performance for reading and writing files. It is recommended for use for
  448. source code, temporary build directories, package caches, and other
  449. IO-intensive operations.</p>
  450. <p>May raise an error for an invalid path, for example, one without a
  451. recognizable drive, but returns <code class="docutils literal notranslate"><span class="pre">False</span></code> on platforms that do not support
  452. Dev Drives. See <a class="reference external" href="https://learn.microsoft.com/windows/dev-drive/">the Windows documentation</a>
  453. for information on enabling and creating Dev Drives.</p>
  454. <div class="availability docutils container">
  455. <p><a class="reference internal" href="intro.html#availability"><span class="std std-ref">Availability</span></a>: Windows.</p>
  456. </div>
  457. <div class="versionadded">
  458. <p><span class="versionmodified added">New in version 3.12.</span></p>
  459. </div>
  460. </dd></dl>
  461. <dl class="py function">
  462. <dt class="sig sig-object py" id="os.path.join">
  463. <span class="sig-prename descclassname"><span class="pre">os.path.</span></span><span class="sig-name descname"><span class="pre">join</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">paths</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#os.path.join" title="Link to this definition">¶</a></dt>
  464. <dd><p>Join one or more path segments intelligently. The return value is the
  465. concatenation of <em>path</em> and all members of <em>*paths</em>, with exactly one
  466. directory separator following each non-empty part, except the last. That is,
  467. the result will only end in a separator if the last part is either empty or
  468. ends in a separator. If a segment is an absolute path (which on Windows
  469. requires both a drive and a root), then all previous segments are ignored and
  470. joining continues from the absolute path segment.</p>
  471. <p>On Windows, the drive is not reset when a rooted path segment (e.g.,
  472. <code class="docutils literal notranslate"><span class="pre">r'\foo'</span></code>) is encountered. If a segment is on a different drive or is an
  473. absolute path, all previous segments are ignored and the drive is reset. Note
  474. that since there is a current directory for each drive,
  475. <code class="docutils literal notranslate"><span class="pre">os.path.join(&quot;c:&quot;,</span> <span class="pre">&quot;foo&quot;)</span></code> represents a path relative to the current
  476. directory on drive <code class="file docutils literal notranslate"><span class="pre">C:</span></code> (<code class="file docutils literal notranslate"><span class="pre">c:foo</span></code>), not <code class="file docutils literal notranslate"><span class="pre">c:\foo</span></code>.</p>
  477. <div class="versionchanged">
  478. <p><span class="versionmodified changed">Changed in version 3.6: </span>Accepts a <a class="reference internal" href="../glossary.html#term-path-like-object"><span class="xref std std-term">path-like object</span></a> for <em>path</em> and <em>paths</em>.</p>
  479. </div>
  480. </dd></dl>
  481. <dl class="py function">
  482. <dt class="sig sig-object py" id="os.path.normcase">
  483. <span class="sig-prename descclassname"><span class="pre">os.path.</span></span><span class="sig-name descname"><span class="pre">normcase</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#os.path.normcase" title="Link to this definition">¶</a></dt>
  484. <dd><p>Normalize the case of a pathname. On Windows, convert all characters in the
  485. pathname to lowercase, and also convert forward slashes to backward slashes.
  486. On other operating systems, return the path unchanged.</p>
  487. <div class="versionchanged">
  488. <p><span class="versionmodified changed">Changed in version 3.6: </span>Accepts a <a class="reference internal" href="../glossary.html#term-path-like-object"><span class="xref std std-term">path-like object</span></a>.</p>
  489. </div>
  490. </dd></dl>
  491. <dl class="py function">
  492. <dt class="sig sig-object py" id="os.path.normpath">
  493. <span class="sig-prename descclassname"><span class="pre">os.path.</span></span><span class="sig-name descname"><span class="pre">normpath</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#os.path.normpath" title="Link to this definition">¶</a></dt>
  494. <dd><blockquote>
  495. <div><p>Normalize a pathname by collapsing redundant separators and up-level
  496. references so that <code class="docutils literal notranslate"><span class="pre">A//B</span></code>, <code class="docutils literal notranslate"><span class="pre">A/B/</span></code>, <code class="docutils literal notranslate"><span class="pre">A/./B</span></code> and <code class="docutils literal notranslate"><span class="pre">A/foo/../B</span></code> all
  497. become <code class="docutils literal notranslate"><span class="pre">A/B</span></code>. This string manipulation may change the meaning of a path
  498. that contains symbolic links. On Windows, it converts forward slashes to
  499. backward slashes. To normalize case, use <a class="reference internal" href="#os.path.normcase" title="os.path.normcase"><code class="xref py py-func docutils literal notranslate"><span class="pre">normcase()</span></code></a>.</p>
  500. </div></blockquote>
  501. <div class="admonition note">
  502. <p class="admonition-title">Note</p>
  503. <blockquote>
  504. <div><p>On POSIX systems, in accordance with <a class="reference external" href="https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13">IEEE Std 1003.1 2013 Edition; 4.13
  505. Pathname Resolution</a>,
  506. if a pathname begins with exactly two slashes, the first component
  507. following the leading characters may be interpreted in an implementation-defined
  508. manner, although more than two leading characters shall be treated as a
  509. single character.</p>
  510. </div></blockquote>
  511. <div class="versionchanged">
  512. <p><span class="versionmodified changed">Changed in version 3.6: </span>Accepts a <a class="reference internal" href="../glossary.html#term-path-like-object"><span class="xref std std-term">path-like object</span></a>.</p>
  513. </div>
  514. </div>
  515. </dd></dl>
  516. <dl class="py function">
  517. <dt class="sig sig-object py" id="os.path.realpath">
  518. <span class="sig-prename descclassname"><span class="pre">os.path.</span></span><span class="sig-name descname"><span class="pre">realpath</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">strict</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#os.path.realpath" title="Link to this definition">¶</a></dt>
  519. <dd><p>Return the canonical path of the specified filename, eliminating any symbolic
  520. links encountered in the path (if they are supported by the operating
  521. system).</p>
  522. <p>If a path doesn’t exist or a symlink loop is encountered, and <em>strict</em> is
  523. <code class="docutils literal notranslate"><span class="pre">True</span></code>, <a class="reference internal" href="exceptions.html#OSError" title="OSError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">OSError</span></code></a> is raised. If <em>strict</em> is <code class="docutils literal notranslate"><span class="pre">False</span></code>, the path is
  524. resolved as far as possible and any remainder is appended without checking
  525. whether it exists.</p>
  526. <div class="admonition note">
  527. <p class="admonition-title">Note</p>
  528. <p>This function emulates the operating system’s procedure for making a path
  529. canonical, which differs slightly between Windows and UNIX with respect
  530. to how links and subsequent path components interact.</p>
  531. <p>Operating system APIs make paths canonical as needed, so it’s not
  532. normally necessary to call this function.</p>
  533. </div>
  534. <div class="versionchanged">
  535. <p><span class="versionmodified changed">Changed in version 3.6: </span>Accepts a <a class="reference internal" href="../glossary.html#term-path-like-object"><span class="xref std std-term">path-like object</span></a>.</p>
  536. </div>
  537. <div class="versionchanged">
  538. <p><span class="versionmodified changed">Changed in version 3.8: </span>Symbolic links and junctions are now resolved on Windows.</p>
  539. </div>
  540. <div class="versionchanged">
  541. <p><span class="versionmodified changed">Changed in version 3.10: </span>The <em>strict</em> parameter was added.</p>
  542. </div>
  543. </dd></dl>
  544. <dl class="py function">
  545. <dt class="sig sig-object py" id="os.path.relpath">
  546. <span class="sig-prename descclassname"><span class="pre">os.path.</span></span><span class="sig-name descname"><span class="pre">relpath</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">start</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">os.curdir</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#os.path.relpath" title="Link to this definition">¶</a></dt>
  547. <dd><p>Return a relative filepath to <em>path</em> either from the current directory or
  548. from an optional <em>start</em> directory. This is a path computation: the
  549. filesystem is not accessed to confirm the existence or nature of <em>path</em> or
  550. <em>start</em>. On Windows, <a class="reference internal" href="exceptions.html#ValueError" title="ValueError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code></a> is raised when <em>path</em> and <em>start</em>
  551. are on different drives.</p>
  552. <p><em>start</em> defaults to <a class="reference internal" href="os.html#os.curdir" title="os.curdir"><code class="xref py py-data docutils literal notranslate"><span class="pre">os.curdir</span></code></a>.</p>
  553. <div class="availability docutils container">
  554. <p><a class="reference internal" href="intro.html#availability"><span class="std std-ref">Availability</span></a>: Unix, Windows.</p>
  555. </div>
  556. <div class="versionchanged">
  557. <p><span class="versionmodified changed">Changed in version 3.6: </span>Accepts a <a class="reference internal" href="../glossary.html#term-path-like-object"><span class="xref std std-term">path-like object</span></a>.</p>
  558. </div>
  559. </dd></dl>
  560. <dl class="py function">
  561. <dt class="sig sig-object py" id="os.path.samefile">
  562. <span class="sig-prename descclassname"><span class="pre">os.path.</span></span><span class="sig-name descname"><span class="pre">samefile</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">path2</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#os.path.samefile" title="Link to this definition">¶</a></dt>
  563. <dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if both pathname arguments refer to the same file or directory.
  564. This is determined by the device number and i-node number and raises an
  565. exception if an <a class="reference internal" href="os.html#os.stat" title="os.stat"><code class="xref py py-func docutils literal notranslate"><span class="pre">os.stat()</span></code></a> call on either pathname fails.</p>
  566. <div class="availability docutils container">
  567. <p><a class="reference internal" href="intro.html#availability"><span class="std std-ref">Availability</span></a>: Unix, Windows.</p>
  568. </div>
  569. <div class="versionchanged">
  570. <p><span class="versionmodified changed">Changed in version 3.2: </span>Added Windows support.</p>
  571. </div>
  572. <div class="versionchanged">
  573. <p><span class="versionmodified changed">Changed in version 3.4: </span>Windows now uses the same implementation as all other platforms.</p>
  574. </div>
  575. <div class="versionchanged">
  576. <p><span class="versionmodified changed">Changed in version 3.6: </span>Accepts a <a class="reference internal" href="../glossary.html#term-path-like-object"><span class="xref std std-term">path-like object</span></a>.</p>
  577. </div>
  578. </dd></dl>
  579. <dl class="py function">
  580. <dt class="sig sig-object py" id="os.path.sameopenfile">
  581. <span class="sig-prename descclassname"><span class="pre">os.path.</span></span><span class="sig-name descname"><span class="pre">sameopenfile</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">fp1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">fp2</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#os.path.sameopenfile" title="Link to this definition">¶</a></dt>
  582. <dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if the file descriptors <em>fp1</em> and <em>fp2</em> refer to the same file.</p>
  583. <div class="availability docutils container">
  584. <p><a class="reference internal" href="intro.html#availability"><span class="std std-ref">Availability</span></a>: Unix, Windows.</p>
  585. </div>
  586. <div class="versionchanged">
  587. <p><span class="versionmodified changed">Changed in version 3.2: </span>Added Windows support.</p>
  588. </div>
  589. <div class="versionchanged">
  590. <p><span class="versionmodified changed">Changed in version 3.6: </span>Accepts a <a class="reference internal" href="../glossary.html#term-path-like-object"><span class="xref std std-term">path-like object</span></a>.</p>
  591. </div>
  592. </dd></dl>
  593. <dl class="py function">
  594. <dt class="sig sig-object py" id="os.path.samestat">
  595. <span class="sig-prename descclassname"><span class="pre">os.path.</span></span><span class="sig-name descname"><span class="pre">samestat</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">stat1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">stat2</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#os.path.samestat" title="Link to this definition">¶</a></dt>
  596. <dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if the stat tuples <em>stat1</em> and <em>stat2</em> refer to the same file.
  597. These structures may have been returned by <a class="reference internal" href="os.html#os.fstat" title="os.fstat"><code class="xref py py-func docutils literal notranslate"><span class="pre">os.fstat()</span></code></a>,
  598. <a class="reference internal" href="os.html#os.lstat" title="os.lstat"><code class="xref py py-func docutils literal notranslate"><span class="pre">os.lstat()</span></code></a>, or <a class="reference internal" href="os.html#os.stat" title="os.stat"><code class="xref py py-func docutils literal notranslate"><span class="pre">os.stat()</span></code></a>. This function implements the
  599. underlying comparison used by <a class="reference internal" href="#os.path.samefile" title="os.path.samefile"><code class="xref py py-func docutils literal notranslate"><span class="pre">samefile()</span></code></a> and <a class="reference internal" href="#os.path.sameopenfile" title="os.path.sameopenfile"><code class="xref py py-func docutils literal notranslate"><span class="pre">sameopenfile()</span></code></a>.</p>
  600. <div class="availability docutils container">
  601. <p><a class="reference internal" href="intro.html#availability"><span class="std std-ref">Availability</span></a>: Unix, Windows.</p>
  602. </div>
  603. <div class="versionchanged">
  604. <p><span class="versionmodified changed">Changed in version 3.4: </span>Added Windows support.</p>
  605. </div>
  606. <div class="versionchanged">
  607. <p><span class="versionmodified changed">Changed in version 3.6: </span>Accepts a <a class="reference internal" href="../glossary.html#term-path-like-object"><span class="xref std std-term">path-like object</span></a>.</p>
  608. </div>
  609. </dd></dl>
  610. <dl class="py function">
  611. <dt class="sig sig-object py" id="os.path.split">
  612. <span class="sig-prename descclassname"><span class="pre">os.path.</span></span><span class="sig-name descname"><span class="pre">split</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#os.path.split" title="Link to this definition">¶</a></dt>
  613. <dd><p>Split the pathname <em>path</em> into a pair, <code class="docutils literal notranslate"><span class="pre">(head,</span> <span class="pre">tail)</span></code> where <em>tail</em> is the
  614. last pathname component and <em>head</em> is everything leading up to that. The
  615. <em>tail</em> part will never contain a slash; if <em>path</em> ends in a slash, <em>tail</em>
  616. will be empty. If there is no slash in <em>path</em>, <em>head</em> will be empty. If
  617. <em>path</em> is empty, both <em>head</em> and <em>tail</em> are empty. Trailing slashes are
  618. stripped from <em>head</em> unless it is the root (one or more slashes only). In
  619. all cases, <code class="docutils literal notranslate"><span class="pre">join(head,</span> <span class="pre">tail)</span></code> returns a path to the same location as <em>path</em>
  620. (but the strings may differ). Also see the functions <a class="reference internal" href="#os.path.dirname" title="os.path.dirname"><code class="xref py py-func docutils literal notranslate"><span class="pre">dirname()</span></code></a> and
  621. <a class="reference internal" href="#os.path.basename" title="os.path.basename"><code class="xref py py-func docutils literal notranslate"><span class="pre">basename()</span></code></a>.</p>
  622. <div class="versionchanged">
  623. <p><span class="versionmodified changed">Changed in version 3.6: </span>Accepts a <a class="reference internal" href="../glossary.html#term-path-like-object"><span class="xref std std-term">path-like object</span></a>.</p>
  624. </div>
  625. </dd></dl>
  626. <dl class="py function">
  627. <dt class="sig sig-object py" id="os.path.splitdrive">
  628. <span class="sig-prename descclassname"><span class="pre">os.path.</span></span><span class="sig-name descname"><span class="pre">splitdrive</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#os.path.splitdrive" title="Link to this definition">¶</a></dt>
  629. <dd><p>Split the pathname <em>path</em> into a pair <code class="docutils literal notranslate"><span class="pre">(drive,</span> <span class="pre">tail)</span></code> where <em>drive</em> is either
  630. a mount point or the empty string. On systems which do not use drive
  631. specifications, <em>drive</em> will always be the empty string. In all cases, <code class="docutils literal notranslate"><span class="pre">drive</span>
  632. <span class="pre">+</span> <span class="pre">tail</span></code> will be the same as <em>path</em>.</p>
  633. <p>On Windows, splits a pathname into drive/UNC sharepoint and relative path.</p>
  634. <p>If the path contains a drive letter, drive will contain everything
  635. up to and including the colon:</p>
  636. <div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">splitdrive</span><span class="p">(</span><span class="s2">&quot;c:/dir&quot;</span><span class="p">)</span>
  637. <span class="go">(&quot;c:&quot;, &quot;/dir&quot;)</span>
  638. </pre></div>
  639. </div>
  640. <p>If the path contains a UNC path, drive will contain the host name
  641. and share:</p>
  642. <div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">splitdrive</span><span class="p">(</span><span class="s2">&quot;//host/computer/dir&quot;</span><span class="p">)</span>
  643. <span class="go">(&quot;//host/computer&quot;, &quot;/dir&quot;)</span>
  644. </pre></div>
  645. </div>
  646. <div class="versionchanged">
  647. <p><span class="versionmodified changed">Changed in version 3.6: </span>Accepts a <a class="reference internal" href="../glossary.html#term-path-like-object"><span class="xref std std-term">path-like object</span></a>.</p>
  648. </div>
  649. </dd></dl>
  650. <dl class="py function">
  651. <dt class="sig sig-object py" id="os.path.splitroot">
  652. <span class="sig-prename descclassname"><span class="pre">os.path.</span></span><span class="sig-name descname"><span class="pre">splitroot</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#os.path.splitroot" title="Link to this definition">¶</a></dt>
  653. <dd><p>Split the pathname <em>path</em> into a 3-item tuple <code class="docutils literal notranslate"><span class="pre">(drive,</span> <span class="pre">root,</span> <span class="pre">tail)</span></code> where
  654. <em>drive</em> is a device name or mount point, <em>root</em> is a string of separators
  655. after the drive, and <em>tail</em> is everything after the root. Any of these
  656. items may be the empty string. In all cases, <code class="docutils literal notranslate"><span class="pre">drive</span> <span class="pre">+</span> <span class="pre">root</span> <span class="pre">+</span> <span class="pre">tail</span></code> will
  657. be the same as <em>path</em>.</p>
  658. <p>On POSIX systems, <em>drive</em> is always empty. The <em>root</em> may be empty (if <em>path</em> is
  659. relative), a single forward slash (if <em>path</em> is absolute), or two forward slashes
  660. (implementation-defined per <a class="reference external" href="https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13">IEEE Std 1003.1-2017; 4.13 Pathname Resolution</a>.)
  661. For example:</p>
  662. <div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">splitroot</span><span class="p">(</span><span class="s1">&#39;/home/sam&#39;</span><span class="p">)</span>
  663. <span class="go">(&#39;&#39;, &#39;/&#39;, &#39;home/sam&#39;)</span>
  664. <span class="gp">&gt;&gt;&gt; </span><span class="n">splitroot</span><span class="p">(</span><span class="s1">&#39;//home/sam&#39;</span><span class="p">)</span>
  665. <span class="go">(&#39;&#39;, &#39;//&#39;, &#39;home/sam&#39;)</span>
  666. <span class="gp">&gt;&gt;&gt; </span><span class="n">splitroot</span><span class="p">(</span><span class="s1">&#39;///home/sam&#39;</span><span class="p">)</span>
  667. <span class="go">(&#39;&#39;, &#39;/&#39;, &#39;//home/sam&#39;)</span>
  668. </pre></div>
  669. </div>
  670. <p>On Windows, <em>drive</em> may be empty, a drive-letter name, a UNC share, or a device
  671. name. The <em>root</em> may be empty, a forward slash, or a backward slash. For
  672. example:</p>
  673. <div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">splitroot</span><span class="p">(</span><span class="s1">&#39;C:/Users/Sam&#39;</span><span class="p">)</span>
  674. <span class="go">(&#39;C:&#39;, &#39;/&#39;, &#39;Users/Sam&#39;)</span>
  675. <span class="gp">&gt;&gt;&gt; </span><span class="n">splitroot</span><span class="p">(</span><span class="s1">&#39;//Server/Share/Users/Sam&#39;</span><span class="p">)</span>
  676. <span class="go">(&#39;//Server/Share&#39;, &#39;/&#39;, &#39;Users/Sam&#39;)</span>
  677. </pre></div>
  678. </div>
  679. <div class="versionadded">
  680. <p><span class="versionmodified added">New in version 3.12.</span></p>
  681. </div>
  682. </dd></dl>
  683. <dl class="py function">
  684. <dt class="sig sig-object py" id="os.path.splitext">
  685. <span class="sig-prename descclassname"><span class="pre">os.path.</span></span><span class="sig-name descname"><span class="pre">splitext</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#os.path.splitext" title="Link to this definition">¶</a></dt>
  686. <dd><p>Split the pathname <em>path</em> into a pair <code class="docutils literal notranslate"><span class="pre">(root,</span> <span class="pre">ext)</span></code> such that <code class="docutils literal notranslate"><span class="pre">root</span> <span class="pre">+</span> <span class="pre">ext</span> <span class="pre">==</span>
  687. <span class="pre">path</span></code>, and the extension, <em>ext</em>, is empty or begins with a period and contains at
  688. most one period.</p>
  689. <p>If the path contains no extension, <em>ext</em> will be <code class="docutils literal notranslate"><span class="pre">''</span></code>:</p>
  690. <div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">splitext</span><span class="p">(</span><span class="s1">&#39;bar&#39;</span><span class="p">)</span>
  691. <span class="go">(&#39;bar&#39;, &#39;&#39;)</span>
  692. </pre></div>
  693. </div>
  694. <p>If the path contains an extension, then <em>ext</em> will be set to this extension,
  695. including the leading period. Note that previous periods will be ignored:</p>
  696. <div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">splitext</span><span class="p">(</span><span class="s1">&#39;foo.bar.exe&#39;</span><span class="p">)</span>
  697. <span class="go">(&#39;foo.bar&#39;, &#39;.exe&#39;)</span>
  698. <span class="gp">&gt;&gt;&gt; </span><span class="n">splitext</span><span class="p">(</span><span class="s1">&#39;/foo/bar.exe&#39;</span><span class="p">)</span>
  699. <span class="go">(&#39;/foo/bar&#39;, &#39;.exe&#39;)</span>
  700. </pre></div>
  701. </div>
  702. <p>Leading periods of the last component of the path are considered to
  703. be part of the root:</p>
  704. <div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">splitext</span><span class="p">(</span><span class="s1">&#39;.cshrc&#39;</span><span class="p">)</span>
  705. <span class="go">(&#39;.cshrc&#39;, &#39;&#39;)</span>
  706. <span class="gp">&gt;&gt;&gt; </span><span class="n">splitext</span><span class="p">(</span><span class="s1">&#39;/foo/....jpg&#39;</span><span class="p">)</span>
  707. <span class="go">(&#39;/foo/....jpg&#39;, &#39;&#39;)</span>
  708. </pre></div>
  709. </div>
  710. <div class="versionchanged">
  711. <p><span class="versionmodified changed">Changed in version 3.6: </span>Accepts a <a class="reference internal" href="../glossary.html#term-path-like-object"><span class="xref std std-term">path-like object</span></a>.</p>
  712. </div>
  713. </dd></dl>
  714. <dl class="py data">
  715. <dt class="sig sig-object py" id="os.path.supports_unicode_filenames">
  716. <span class="sig-prename descclassname"><span class="pre">os.path.</span></span><span class="sig-name descname"><span class="pre">supports_unicode_filenames</span></span><a class="headerlink" href="#os.path.supports_unicode_filenames" title="Link to this definition">¶</a></dt>
  717. <dd><p><code class="docutils literal notranslate"><span class="pre">True</span></code> if arbitrary Unicode strings can be used as file names (within limitations
  718. imposed by the file system).</p>
  719. </dd></dl>
  720. </section>
  721. <div class="clearer"></div>
  722. </div>
  723. </div>
  724. </div>
  725. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  726. <div class="sphinxsidebarwrapper">
  727. <div>
  728. <h4>Previous topic</h4>
  729. <p class="topless"><a href="pathlib.html"
  730. title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pathlib</span></code> — Object-oriented filesystem paths</a></p>
  731. </div>
  732. <div>
  733. <h4>Next topic</h4>
  734. <p class="topless"><a href="fileinput.html"
  735. title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">fileinput</span></code> — Iterate over lines from multiple input streams</a></p>
  736. </div>
  737. <div role="note" aria-label="source link">
  738. <h3>This Page</h3>
  739. <ul class="this-page-menu">
  740. <li><a href="../bugs.html">Report a Bug</a></li>
  741. <li>
  742. <a href="https://github.com/python/cpython/blob/main/Doc/library/os.path.rst"
  743. rel="nofollow">Show Source
  744. </a>
  745. </li>
  746. </ul>
  747. </div>
  748. </div>
  749. <div id="sidebarbutton" title="Collapse sidebar">
  750. <span>«</span>
  751. </div>
  752. </div>
  753. <div class="clearer"></div>
  754. </div>
  755. <div class="related" role="navigation" aria-label="related navigation">
  756. <h3>Navigation</h3>
  757. <ul>
  758. <li class="right" style="margin-right: 10px">
  759. <a href="../genindex.html" title="General Index"
  760. >index</a></li>
  761. <li class="right" >
  762. <a href="../py-modindex.html" title="Python Module Index"
  763. >modules</a> |</li>
  764. <li class="right" >
  765. <a href="fileinput.html" title="fileinput — Iterate over lines from multiple input streams"
  766. >next</a> |</li>
  767. <li class="right" >
  768. <a href="pathlib.html" title="pathlib — Object-oriented filesystem paths"
  769. >previous</a> |</li>
  770. <li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
  771. <li><a href="https://www.python.org/">Python</a> &#187;</li>
  772. <li class="switchers">
  773. <div class="language_switcher_placeholder"></div>
  774. <div class="version_switcher_placeholder"></div>
  775. </li>
  776. <li>
  777. </li>
  778. <li id="cpython-language-and-version">
  779. <a href="../index.html">3.12.3 Documentation</a> &#187;
  780. </li>
  781. <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>
  782. <li class="nav-item nav-item-2"><a href="filesys.html" >File and Directory Access</a> &#187;</li>
  783. <li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">os.path</span></code> — Common pathname manipulations</a></li>
  784. <li class="right">
  785. <div class="inline-search" role="search">
  786. <form class="inline-search" action="../search.html" method="get">
  787. <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
  788. <input type="submit" value="Go" />
  789. </form>
  790. </div>
  791. |
  792. </li>
  793. <li class="right">
  794. <label class="theme-selector-label">
  795. Theme
  796. <select class="theme-selector" oninput="activateTheme(this.value)">
  797. <option value="auto" selected>Auto</option>
  798. <option value="light">Light</option>
  799. <option value="dark">Dark</option>
  800. </select>
  801. </label> |</li>
  802. </ul>
  803. </div>
  804. <div class="footer">
  805. &copy;
  806. <a href="../copyright.html">
  807. Copyright
  808. </a>
  809. 2001-2024, Python Software Foundation.
  810. <br />
  811. This page is licensed under the Python Software Foundation License Version 2.
  812. <br />
  813. Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
  814. <br />
  815. See <a href="/license.html">History and License</a> for more information.<br />
  816. <br />
  817. The Python Software Foundation is a non-profit corporation.
  818. <a href="https://www.python.org/psf/donations/">Please donate.</a>
  819. <br />
  820. <br />
  821. Last updated on Apr 09, 2024 (13:47 UTC).
  822. <a href="/bugs.html">Found a bug</a>?
  823. <br />
  824. Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.2.6.
  825. </div>
  826. </body>
  827. </html>
上海开阖软件有限公司 沪ICP备12045867号-1