diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2001-02-09 09:48:45 (GMT) |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2001-02-09 09:48:45 (GMT) |
commit | db5ebc7bc9ac64b7ca43c6387e75f4d8e8148188 (patch) | |
tree | 11ea2da677b1a5c6f8ce6f49e010cb8c7626312b /Lib/macurl2path.py | |
parent | 51cc3bcd1c2c925825de8384a9cb70088d08d286 (diff) | |
download | cpython-db5ebc7bc9ac64b7ca43c6387e75f4d8e8148188.zip cpython-db5ebc7bc9ac64b7ca43c6387e75f4d8e8148188.tar.gz cpython-db5ebc7bc9ac64b7ca43c6387e75f4d8e8148188.tar.bz2 |
String method conversion.
Diffstat (limited to 'Lib/macurl2path.py')
-rw-r--r-- | Lib/macurl2path.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/Lib/macurl2path.py b/Lib/macurl2path.py index a8be198..3c1acc0 100644 --- a/Lib/macurl2path.py +++ b/Lib/macurl2path.py @@ -2,7 +2,6 @@ Do not import directly; use urllib instead.""" -import string import urllib import os @@ -21,7 +20,7 @@ def url2pathname(pathname): pathname = pathname[2:] elif pathname[:2] == '//': raise RuntimeError, 'Cannot convert non-local URL to pathname' - components = string.split(pathname, '/') + components = pathname.split('/') # Remove . and embedded .. i = 0 while i < len(components): @@ -37,7 +36,7 @@ def url2pathname(pathname): i = i+1 if not components[0]: # Absolute unix path, don't start with colon - rv = string.join(components[1:], ':') + rv = ':'.join(components[1:]) else: # relative unix path, start with colon. First replace # leading .. by empty strings (giving ::file) @@ -45,7 +44,7 @@ def url2pathname(pathname): while i < len(components) and components[i] == '..': components[i] = '' i = i + 1 - rv = ':' + string.join(components, ':') + rv = ':' + ':'.join(components) # and finally unquote slashes and other funny characters return urllib.unquote(rv) @@ -53,7 +52,7 @@ def pathname2url(pathname): "convert mac pathname to /-delimited pathname" if '/' in pathname: raise RuntimeError, "Cannot convert pathname containing slashes" - components = string.split(pathname, ':') + components = pathname.split(':') # Remove empty first and/or last component if components[0] == '': del components[0] @@ -67,9 +66,9 @@ def pathname2url(pathname): components = map(_pncomp2url, components) if os.path.isabs(pathname): - return '/' + string.join(components, '/') + return '/' + '/'.join(components) else: - return string.join(components, '/') + return '/'.join(components) def _pncomp2url(component): component = urllib.quote(component[:31], safe='') # We want to quote slashes |