1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module posixpath</title>
</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/python2.6/posixpath.py">/usr/lib/python2.6/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="warnings.html">warnings</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">='.'</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>
<dl><dt><a name="-walk"><strong>walk</strong></a>(top, func, arg)</dt><dd><tt>Directory tree walk with callback function.<br>
<br>
For each directory in the directory tree rooted at top (including top<br>
itself, but excluding '.' and '..'), call func(arg, dirname, fnames).<br>
dirname is the name of the directory, and fnames a list of the names of<br>
the files and subdirectories in dirname (excluding '.' and '..'). func<br>
may modify the fnames list in-place (e.g. via del or slice assignment),<br>
and walk will only recurse into the subdirectories whose names remain in<br>
fnames; this can be used to implement a filter, or to impose a specific<br>
order of visiting. No semantics are defined for, or required of, arg,<br>
beyond that arg is always passed to func. It can be used, e.g., to pass<br>
a filename pattern, or a mutable object designed to accumulate<br>
statistics. Passing None for arg is common.</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', 'walk', ...]<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>
|