summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2000-09-28 15:04:39 (GMT)
committerFred Drake <fdrake@acm.org>2000-09-28 15:04:39 (GMT)
commit22fb839f0c06bbd614d9e827b8991b82e921a69a (patch)
treea9dac2a51c1828a34255d8dc436fb13aa298b664
parentb64c2239b0e2e92535f0f5f7c2cc7d1729c396bf (diff)
downloadcpython-22fb839f0c06bbd614d9e827b8991b82e921a69a.zip
cpython-22fb839f0c06bbd614d9e827b8991b82e921a69a.tar.gz
cpython-22fb839f0c06bbd614d9e827b8991b82e921a69a.tar.bz2
Remove imports of string when string methods will do.
-rw-r--r--Lib/posixpath.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/Lib/posixpath.py b/Lib/posixpath.py
index f7e0161..d77b595 100644
--- a/Lib/posixpath.py
+++ b/Lib/posixpath.py
@@ -57,8 +57,7 @@ def join(a, *p):
def split(p):
"""Split a pathname. Returns tuple "(head, tail)" where "tail" is
everything after the final slash. Either part may be empty"""
- import string
- i = string.rfind(p, '/') + 1
+ i = p.rfind('/') + 1
head, tail = p[:i], p[i:]
if head and head <> '/'*len(head):
while head[-1] == '/':
@@ -344,9 +343,8 @@ def normpath(path):
"""Normalize path, eliminating double slashes, etc."""
if path == '':
return '.'
- import string
initial_slash = (path[0] == '/')
- comps = string.split(path, '/')
+ comps = path.split('/')
new_comps = []
for comp in comps:
if comp in ('', '.'):
@@ -357,7 +355,7 @@ def normpath(path):
elif new_comps:
new_comps.pop()
comps = new_comps
- path = string.join(comps, '/')
+ path = '/'.join(comps)
if initial_slash:
path = '/' + path
return path or '.'