summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2001-02-09 16:45:10 (GMT)
committerEric S. Raymond <esr@thyrsus.com>2001-02-09 16:45:10 (GMT)
commitdcd3a875a57f5cc616e96f7c4848b3e32143b4d3 (patch)
treef684cf3cd4c49d745516c6e5d91dfdc39ff6d4c7 /Lib
parent62f1a23ade8d9cddc064026cb4b95131f66de2ef (diff)
downloadcpython-dcd3a875a57f5cc616e96f7c4848b3e32143b4d3.zip
cpython-dcd3a875a57f5cc616e96f7c4848b3e32143b4d3.tar.gz
cpython-dcd3a875a57f5cc616e96f7c4848b3e32143b4d3.tar.bz2
String method conversion.
Diffstat (limited to 'Lib')
-rwxr-xr-xLib/plat-irix5/cddb.py23
-rw-r--r--Lib/plat-irix6/cddb.py25
2 files changed, 23 insertions, 25 deletions
diff --git a/Lib/plat-irix5/cddb.py b/Lib/plat-irix5/cddb.py
index acd7870..e43aea6 100755
--- a/Lib/plat-irix5/cddb.py
+++ b/Lib/plat-irix5/cddb.py
@@ -30,8 +30,8 @@ def tochash(toc):
tracklist = []
for i in range(2, len(toc), 4):
tracklist.append((None,
- (string.atoi(toc[i:i+2]),
- string.atoi(toc[i+2:i+4]))))
+ (int(toc[i:i+2]),
+ int(toc[i+2:i+4]))))
else:
tracklist = toc
ntracks = len(tracklist)
@@ -58,7 +58,7 @@ class Cddb:
def __init__(self, tracklist):
if os.environ.has_key('CDDB_PATH'):
path = os.environ['CDDB_PATH']
- cddb_path = string.splitfields(path, ',')
+ cddb_path = path.split(',')
else:
home = os.environ['HOME']
cddb_path = [home + '/' + _cddbrc]
@@ -73,7 +73,7 @@ class Cddb:
break
except IOError:
pass
- ntracks = string.atoi(self.id[:2], 16)
+ ntracks = int(self.id[:2], 16)
self.artist = ''
self.title = ''
self.track = [None] + [''] * ntracks
@@ -106,7 +106,7 @@ class Cddb:
self.notes.append(value)
elif name1[:5] == 'track':
try:
- trackno = string.atoi(name1[5:])
+ trackno = int(name1[5:])
except strings.atoi_error:
print 'syntax error in ' + file
continue
@@ -126,9 +126,8 @@ class Cddb:
# of previous track's title
if track and track[0] == ',':
try:
- off = string.index(self.track[i - 1],
- ',')
- except string.index_error:
+ off = self.track[i - 1].index(',')
+ except ValueError:
pass
else:
self.track[i] = self.track[i-1][:off] \
@@ -146,8 +145,8 @@ class Cddb:
t = []
for i in range(2, len(tracklist), 4):
t.append((None, \
- (string.atoi(tracklist[i:i+2]), \
- string.atoi(tracklist[i+2:i+4]))))
+ (int(tracklist[i:i+2]), \
+ int(tracklist[i+2:i+4]))))
tracklist = t
ntracks = len(tracklist)
self.id = _dbid((ntracks >> 4) & 0xF) + _dbid(ntracks & 0xF)
@@ -195,8 +194,8 @@ class Cddb:
f.write('track'+`i`+'.artist:\t'+self.trackartist[i]+'\n')
track = self.track[i]
try:
- off = string.index(track, ',')
- except string.index_error:
+ off = track.index(',')
+ except ValuError:
prevpref = None
else:
if prevpref and track[:off] == prevpref:
diff --git a/Lib/plat-irix6/cddb.py b/Lib/plat-irix6/cddb.py
index acd7870..96025e7 100644
--- a/Lib/plat-irix6/cddb.py
+++ b/Lib/plat-irix6/cddb.py
@@ -30,8 +30,8 @@ def tochash(toc):
tracklist = []
for i in range(2, len(toc), 4):
tracklist.append((None,
- (string.atoi(toc[i:i+2]),
- string.atoi(toc[i+2:i+4]))))
+ (int(toc[i:i+2]),
+ int(toc[i+2:i+4]))))
else:
tracklist = toc
ntracks = len(tracklist)
@@ -58,7 +58,7 @@ class Cddb:
def __init__(self, tracklist):
if os.environ.has_key('CDDB_PATH'):
path = os.environ['CDDB_PATH']
- cddb_path = string.splitfields(path, ',')
+ cddb_path = path.split(',')
else:
home = os.environ['HOME']
cddb_path = [home + '/' + _cddbrc]
@@ -73,7 +73,7 @@ class Cddb:
break
except IOError:
pass
- ntracks = string.atoi(self.id[:2], 16)
+ ntracks = int(self.id[:2], 16)
self.artist = ''
self.title = ''
self.track = [None] + [''] * ntracks
@@ -106,8 +106,8 @@ class Cddb:
self.notes.append(value)
elif name1[:5] == 'track':
try:
- trackno = string.atoi(name1[5:])
- except strings.atoi_error:
+ trackno = int(name1[5:])
+ except ValueError:
print 'syntax error in ' + file
continue
if trackno > ntracks:
@@ -126,9 +126,8 @@ class Cddb:
# of previous track's title
if track and track[0] == ',':
try:
- off = string.index(self.track[i - 1],
- ',')
- except string.index_error:
+ off = self.track[i - 1].index(',')
+ except ValueError:
pass
else:
self.track[i] = self.track[i-1][:off] \
@@ -146,8 +145,8 @@ class Cddb:
t = []
for i in range(2, len(tracklist), 4):
t.append((None, \
- (string.atoi(tracklist[i:i+2]), \
- string.atoi(tracklist[i+2:i+4]))))
+ (int(tracklist[i:i+2]), \
+ int(tracklist[i+2:i+4]))))
tracklist = t
ntracks = len(tracklist)
self.id = _dbid((ntracks >> 4) & 0xF) + _dbid(ntracks & 0xF)
@@ -195,8 +194,8 @@ class Cddb:
f.write('track'+`i`+'.artist:\t'+self.trackartist[i]+'\n')
track = self.track[i]
try:
- off = string.index(track, ',')
- except string.index_error:
+ off = track.index(',')
+ except ValueError:
prevpref = None
else:
if prevpref and track[:off] == prevpref: