<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><title>Python: module posixpath</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head><body bgcolor="#f0f0f8"> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> <tr bgcolor="#7799ee"> <td valign=bottom> <br> <font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>posixpath</strong></big></big></font></td ><td align=right valign=bottom ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/usr/lib/python3.1/posixpath.py">/usr/lib/python3.1/posixpath.py</a><br><a href="http://docs.python.org/library/posixpath">Module Docs</a></font></td></tr></table> <p><tt>Common operations on Posix pathnames.<br> <br> Instead of importing this module directly, import os and refer to<br> this module as os.path. The "os.path" name is an alias for this<br> module on Posix systems; on other systems (e.g. Mac, Windows),<br> os.path provides the same operations in a manner specific to that<br> platform, and is an alias to another module (e.g. macpath, ntpath).<br> <br> Some of this can actually be useful on non-Posix systems too, e.g.<br> for manipulation of the pathname component of URLs.</tt></p> <p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#aa55cc"> <td colspan=3 valign=bottom> <br> <font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr> <tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td> <td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="genericpath.html">genericpath</a><br> </td><td width="25%" valign=top><a href="os.html">os</a><br> </td><td width="25%" valign=top><a href="stat.html">stat</a><br> </td><td width="25%" valign=top><a href="sys.html">sys</a><br> </td></tr></table></td></tr></table><p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#eeaa77"> <td colspan=3 valign=bottom> <br> <font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr> <tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td> <td width="100%"><dl><dt><a name="-abspath"><strong>abspath</strong></a>(path)</dt><dd><tt>Return an absolute path.</tt></dd></dl> <dl><dt><a name="-basename"><strong>basename</strong></a>(p)</dt><dd><tt>Returns the final component of a pathname</tt></dd></dl> <dl><dt><a name="-commonprefix"><strong>commonprefix</strong></a>(m)</dt><dd><tt>Given a list of pathnames, returns the longest common leading component</tt></dd></dl> <dl><dt><a name="-dirname"><strong>dirname</strong></a>(p)</dt><dd><tt>Returns the directory component of a pathname</tt></dd></dl> <dl><dt><a name="-exists"><strong>exists</strong></a>(path)</dt><dd><tt>Test whether a path exists. Returns False for broken symbolic links</tt></dd></dl> <dl><dt><a name="-expanduser"><strong>expanduser</strong></a>(path)</dt><dd><tt>Expand ~ and ~user constructions. If user or $HOME is unknown,<br> do nothing.</tt></dd></dl> <dl><dt><a name="-expandvars"><strong>expandvars</strong></a>(path)</dt><dd><tt>Expand shell variables of form $var and ${var}. Unknown variables<br> are left unchanged.</tt></dd></dl> <dl><dt><a name="-getatime"><strong>getatime</strong></a>(filename)</dt><dd><tt>Return the last access time of a file, reported by os.stat().</tt></dd></dl> <dl><dt><a name="-getctime"><strong>getctime</strong></a>(filename)</dt><dd><tt>Return the metadata change time of a file, reported by os.stat().</tt></dd></dl> <dl><dt><a name="-getmtime"><strong>getmtime</strong></a>(filename)</dt><dd><tt>Return the last modification time of a file, reported by os.stat().</tt></dd></dl> <dl><dt><a name="-getsize"><strong>getsize</strong></a>(filename)</dt><dd><tt>Return the size of a file, reported by os.stat().</tt></dd></dl> <dl><dt><a name="-isabs"><strong>isabs</strong></a>(s)</dt><dd><tt>Test whether a path is absolute</tt></dd></dl> <dl><dt><a name="-isdir"><strong>isdir</strong></a>(s)</dt><dd><tt>Return true if the pathname refers to an existing directory.</tt></dd></dl> <dl><dt><a name="-isfile"><strong>isfile</strong></a>(path)</dt><dd><tt>Test whether a path is a regular file</tt></dd></dl> <dl><dt><a name="-islink"><strong>islink</strong></a>(path)</dt><dd><tt>Test whether a path is a symbolic link</tt></dd></dl> <dl><dt><a name="-ismount"><strong>ismount</strong></a>(path)</dt><dd><tt>Test whether a path is a mount point</tt></dd></dl> <dl><dt><a name="-join"><strong>join</strong></a>(a, *p)</dt><dd><tt>Join two or more pathname components, inserting '/' as needed.<br> If any component is an absolute path, all previous path components<br> will be discarded.</tt></dd></dl> <dl><dt><a name="-lexists"><strong>lexists</strong></a>(path)</dt><dd><tt>Test whether a path exists. Returns True for broken symbolic links</tt></dd></dl> <dl><dt><a name="-normcase"><strong>normcase</strong></a>(s)</dt><dd><tt>Normalize case of pathname. Has no effect under Posix</tt></dd></dl> <dl><dt><a name="-normpath"><strong>normpath</strong></a>(path)</dt><dd><tt>Normalize path, eliminating double slashes, etc.</tt></dd></dl> <dl><dt><a name="-realpath"><strong>realpath</strong></a>(filename)</dt><dd><tt>Return the canonical path of the specified filename, eliminating any<br> symbolic links encountered in the path.</tt></dd></dl> <dl><dt><a name="-relpath"><strong>relpath</strong></a>(path, start<font color="#909090">=None</font>)</dt><dd><tt>Return a relative version of a path</tt></dd></dl> <dl><dt><a name="-samefile"><strong>samefile</strong></a>(f1, f2)</dt><dd><tt>Test whether two pathnames reference the same actual file</tt></dd></dl> <dl><dt><a name="-sameopenfile"><strong>sameopenfile</strong></a>(fp1, fp2)</dt><dd><tt>Test whether two open file objects reference the same file</tt></dd></dl> <dl><dt><a name="-samestat"><strong>samestat</strong></a>(s1, s2)</dt><dd><tt>Test whether two stat buffers reference the same file</tt></dd></dl> <dl><dt><a name="-split"><strong>split</strong></a>(p)</dt><dd><tt>Split a pathname. Returns tuple "(head, tail)" where "tail" is<br> everything after the final slash. Either part may be empty.</tt></dd></dl> <dl><dt><a name="-splitdrive"><strong>splitdrive</strong></a>(p)</dt><dd><tt>Split a pathname into drive and path. On Posix, drive is always<br> empty.</tt></dd></dl> <dl><dt><a name="-splitext"><strong>splitext</strong></a>(p)</dt><dd><tt>Split the extension from a pathname.<br> <br> Extension is everything from the last dot to the end, ignoring<br> leading dots. Returns "(root, ext)"; ext may be empty.</tt></dd></dl> </td></tr></table><p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#55aa55"> <td colspan=3 valign=bottom> <br> <font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr> <tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td> <td width="100%"><strong>__all__</strong> = ['normcase', 'isabs', 'join', 'splitdrive', 'split', 'splitext', 'basename', 'dirname', 'commonprefix', 'getsize', 'getmtime', 'getatime', 'getctime', 'islink', 'exists', 'lexists', 'isdir', 'isfile', 'ismount', 'expanduser', ...]<br> <strong>altsep</strong> = None<br> <strong>curdir</strong> = '.'<br> <strong>defpath</strong> = ':/bin:/usr/bin'<br> <strong>devnull</strong> = '/dev/null'<br> <strong>extsep</strong> = '.'<br> <strong>pardir</strong> = '..'<br> <strong>pathsep</strong> = ':'<br> <strong>sep</strong> = '/'<br> <strong>supports_unicode_filenames</strong> = False</td></tr></table> </body></html>