summary refs log tree commit diff stats
path: root/doc/os.path.html
blob: a5b893f507903fe1dddb54c86838010c200cdcc4 (plain) (blame)
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
<!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>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<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&nbsp;operations&nbsp;on&nbsp;Posix&nbsp;pathnames.<br>
&nbsp;<br>
Instead&nbsp;of&nbsp;importing&nbsp;this&nbsp;module&nbsp;directly,&nbsp;import&nbsp;os&nbsp;and&nbsp;refer&nbsp;to<br>
this&nbsp;module&nbsp;as&nbsp;os.path.&nbsp;&nbsp;The&nbsp;"os.path"&nbsp;name&nbsp;is&nbsp;an&nbsp;alias&nbsp;for&nbsp;this<br>
module&nbsp;on&nbsp;Posix&nbsp;systems;&nbsp;on&nbsp;other&nbsp;systems&nbsp;(e.g.&nbsp;Mac,&nbsp;Windows),<br>
os.path&nbsp;provides&nbsp;the&nbsp;same&nbsp;operations&nbsp;in&nbsp;a&nbsp;manner&nbsp;specific&nbsp;to&nbsp;that<br>
platform,&nbsp;and&nbsp;is&nbsp;an&nbsp;alias&nbsp;to&nbsp;another&nbsp;module&nbsp;(e.g.&nbsp;macpath,&nbsp;ntpath).<br>
&nbsp;<br>
Some&nbsp;of&nbsp;this&nbsp;can&nbsp;actually&nbsp;be&nbsp;useful&nbsp;on&nbsp;non-Posix&nbsp;systems&nbsp;too,&nbsp;e.g.<br>
for&nbsp;manipulation&nbsp;of&nbsp;the&nbsp;pathname&nbsp;component&nbsp;of&nbsp;URLs.</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
    
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</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>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
    
<tr><td bgcolor="#eeaa77"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl><dt><a name="-abspath"><strong>abspath</strong></a>(path)</dt><dd><tt>Return&nbsp;an&nbsp;absolute&nbsp;path.</tt></dd></dl>
 <dl><dt><a name="-basename"><strong>basename</strong></a>(p)</dt><dd><tt>Returns&nbsp;the&nbsp;final&nbsp;component&nbsp;of&nbsp;a&nbsp;pathname</tt></dd></dl>
 <dl><dt><a name="-commonprefix"><strong>commonprefix</strong></a>(m)</dt><dd><tt>Given&nbsp;a&nbsp;list&nbsp;of&nbsp;pathnames,&nbsp;returns&nbsp;the&nbsp;longest&nbsp;common&nbsp;leading&nbsp;component</tt></dd></dl>
 <dl><dt><a name="-dirname"><strong>dirname</strong></a>(p)</dt><dd><tt>Returns&nbsp;the&nbsp;directory&nbsp;component&nbsp;of&nbsp;a&nbsp;pathname</tt></dd></dl>
 <dl><dt><a name="-exists"><strong>exists</strong></a>(path)</dt><dd><tt>Test&nbsp;whether&nbsp;a&nbsp;path&nbsp;exists.&nbsp;&nbsp;Returns&nbsp;False&nbsp;for&nbsp;broken&nbsp;symbolic&nbsp;links</tt></dd></dl>
 <dl><dt><a name="-expanduser"><strong>expanduser</strong></a>(path)</dt><dd><tt>Expand&nbsp;~&nbsp;and&nbsp;~user&nbsp;constructions.&nbsp;&nbsp;If&nbsp;user&nbsp;or&nbsp;$HOME&nbsp;is&nbsp;unknown,<br>
do&nbsp;nothing.</tt></dd></dl>
 <dl><dt><a name="-expandvars"><strong>expandvars</strong></a>(path)</dt><dd><tt>Expand&nbsp;shell&nbsp;variables&nbsp;of&nbsp;form&nbsp;$var&nbsp;and&nbsp;${var}.&nbsp;&nbsp;Unknown&nbsp;variables<br>
are&nbsp;left&nbsp;unchanged.</tt></dd></dl>
 <dl><dt><a name="-getatime"><strong>getatime</strong></a>(filename)</dt><dd><tt>Return&nbsp;the&nbsp;last&nbsp;access&nbsp;time&nbsp;of&nbsp;a&nbsp;file,&nbsp;reported&nbsp;by&nbsp;os.stat().</tt></dd></dl>
 <dl><dt><a name="-getctime"><strong>getctime</strong></a>(filename)</dt><dd><tt>Return&nbsp;the&nbsp;metadata&nbsp;change&nbsp;time&nbsp;of&nbsp;a&nbsp;file,&nbsp;reported&nbsp;by&nbsp;os.stat().</tt></dd></dl>
 <dl><dt><a name="-getmtime"><strong>getmtime</strong></a>(filename)</dt><dd><tt>Return&nbsp;the&nbsp;last&nbsp;modification&nbsp;time&nbsp;of&nbsp;a&nbsp;file,&nbsp;reported&nbsp;by&nbsp;os.stat().</tt></dd></dl>
 <dl><dt><a name="-getsize"><strong>getsize</strong></a>(filename)</dt><dd><tt>Return&nbsp;the&nbsp;size&nbsp;of&nbsp;a&nbsp;file,&nbsp;reported&nbsp;by&nbsp;os.stat().</tt></dd></dl>
 <dl><dt><a name="-isabs"><strong>isabs</strong></a>(s)</dt><dd><tt>Test&nbsp;whether&nbsp;a&nbsp;path&nbsp;is&nbsp;absolute</tt></dd></dl>
 <dl><dt><a name="-isdir"><strong>isdir</strong></a>(s)</dt><dd><tt>Return&nbsp;true&nbsp;if&nbsp;the&nbsp;pathname&nbsp;refers&nbsp;to&nbsp;an&nbsp;existing&nbsp;directory.</tt></dd></dl>
 <dl><dt><a name="-isfile"><strong>isfile</strong></a>(path)</dt><dd><tt>Test&nbsp;whether&nbsp;a&nbsp;path&nbsp;is&nbsp;a&nbsp;regular&nbsp;file</tt></dd></dl>
 <dl><dt><a name="-islink"><strong>islink</strong></a>(path)</dt><dd><tt>Test&nbsp;whether&nbsp;a&nbsp;path&nbsp;is&nbsp;a&nbsp;symbolic&nbsp;link</tt></dd></dl>
 <dl><dt><a name="-ismount"><strong>ismount</strong></a>(path)</dt><dd><tt>Test&nbsp;whether&nbsp;a&nbsp;path&nbsp;is&nbsp;a&nbsp;mount&nbsp;point</tt></dd></dl>
 <dl><dt><a name="-join"><strong>join</strong></a>(a, *p)</dt><dd><tt>Join&nbsp;two&nbsp;or&nbsp;more&nbsp;pathname&nbsp;components,&nbsp;inserting&nbsp;'/'&nbsp;as&nbsp;needed.<br>
If&nbsp;any&nbsp;component&nbsp;is&nbsp;an&nbsp;absolute&nbsp;path,&nbsp;all&nbsp;previous&nbsp;path&nbsp;components<br>
will&nbsp;be&nbsp;discarded.</tt></dd></dl>
 <dl><dt><a name="-lexists"><strong>lexists</strong></a>(path)</dt><dd><tt>Test&nbsp;whether&nbsp;a&nbsp;path&nbsp;exists.&nbsp;&nbsp;Returns&nbsp;True&nbsp;for&nbsp;broken&nbsp;symbolic&nbsp;links</tt></dd></dl>
 <dl><dt><a name="-normcase"><strong>normcase</strong></a>(s)</dt><dd><tt>Normalize&nbsp;case&nbsp;of&nbsp;pathname.&nbsp;&nbsp;Has&nbsp;no&nbsp;effect&nbsp;under&nbsp;Posix</tt></dd></dl>
 <dl><dt><a name="-normpath"><strong>normpath</strong></a>(path)</dt><dd><tt>Normalize&nbsp;path,&nbsp;eliminating&nbsp;double&nbsp;slashes,&nbsp;etc.</tt></dd></dl>
 <dl><dt><a name="-realpath"><strong>realpath</strong></a>(filename)</dt><dd><tt>Return&nbsp;the&nbsp;canonical&nbsp;path&nbsp;of&nbsp;the&nbsp;specified&nbsp;filename,&nbsp;eliminating&nbsp;any<br>
symbolic&nbsp;links&nbsp;encountered&nbsp;in&nbsp;the&nbsp;path.</tt></dd></dl>
 <dl><dt><a name="-relpath"><strong>relpath</strong></a>(path, start<font color="#909090">=None</font>)</dt><dd><tt>Return&nbsp;a&nbsp;relative&nbsp;version&nbsp;of&nbsp;a&nbsp;path</tt></dd></dl>
 <dl><dt><a name="-samefile"><strong>samefile</strong></a>(f1, f2)</dt><dd><tt>Test&nbsp;whether&nbsp;two&nbsp;pathnames&nbsp;reference&nbsp;the&nbsp;same&nbsp;actual&nbsp;file</tt></dd></dl>
 <dl><dt><a name="-sameopenfile"><strong>sameopenfile</strong></a>(fp1, fp2)</dt><dd><tt>Test&nbsp;whether&nbsp;two&nbsp;open&nbsp;file&nbsp;objects&nbsp;reference&nbsp;the&nbsp;same&nbsp;file</tt></dd></dl>
 <dl><dt><a name="-samestat"><strong>samestat</strong></a>(s1, s2)</dt><dd><tt>Test&nbsp;whether&nbsp;two&nbsp;stat&nbsp;buffers&nbsp;reference&nbsp;the&nbsp;same&nbsp;file</tt></dd></dl>
 <dl><dt><a name="-split"><strong>split</strong></a>(p)</dt><dd><tt>Split&nbsp;a&nbsp;pathname.&nbsp;&nbsp;Returns&nbsp;tuple&nbsp;"(head,&nbsp;tail)"&nbsp;where&nbsp;"tail"&nbsp;is<br>
everything&nbsp;after&nbsp;the&nbsp;final&nbsp;slash.&nbsp;&nbsp;Either&nbsp;part&nbsp;may&nbsp;be&nbsp;empty.</tt></dd></dl>
 <dl><dt><a name="-splitdrive"><strong>splitdrive</strong></a>(p)</dt><dd><tt>Split&nbsp;a&nbsp;pathname&nbsp;into&nbsp;drive&nbsp;and&nbsp;path.&nbsp;On&nbsp;Posix,&nbsp;drive&nbsp;is&nbsp;always<br>
empty.</tt></dd></dl>
 <dl><dt><a name="-splitext"><strong>splitext</strong></a>(p)</dt><dd><tt>Split&nbsp;the&nbsp;extension&nbsp;from&nbsp;a&nbsp;pathname.<br>
&nbsp;<br>
Extension&nbsp;is&nbsp;everything&nbsp;from&nbsp;the&nbsp;last&nbsp;dot&nbsp;to&nbsp;the&nbsp;end,&nbsp;ignoring<br>
leading&nbsp;dots.&nbsp;&nbsp;Returns&nbsp;"(root,&nbsp;ext)";&nbsp;ext&nbsp;may&nbsp;be&nbsp;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>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
    
<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</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>