diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2001-02-09 05:19:09 (GMT) |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2001-02-09 05:19:09 (GMT) |
commit | 9eb54d982808806d40347ecee39eb129c8fbbc95 (patch) | |
tree | 5bc2d4e13fe0234b06d33415adb4ea1696b19c91 /Lib/ConfigParser.py | |
parent | b49f4a4b15228799aad77ba569971a23d21cc4f7 (diff) | |
download | cpython-9eb54d982808806d40347ecee39eb129c8fbbc95.zip cpython-9eb54d982808806d40347ecee39eb129c8fbbc95.tar.gz cpython-9eb54d982808806d40347ecee39eb129c8fbbc95.tar.bz2 |
String method conversion.
Diffstat (limited to 'Lib/ConfigParser.py')
-rw-r--r-- | Lib/ConfigParser.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Lib/ConfigParser.py b/Lib/ConfigParser.py index 6d1e6f4..d36f11d 100644 --- a/Lib/ConfigParser.py +++ b/Lib/ConfigParser.py @@ -293,7 +293,7 @@ class ConfigParser: depth = 0 while depth < 10: # Loop through this until it's done depth = depth + 1 - if string.find(value, "%(") >= 0: + if value.find("%(") >= 0: try: value = value % d except KeyError, key: @@ -315,13 +315,13 @@ class ConfigParser: def getboolean(self, section, option): v = self.get(section, option) - val = string.atoi(v) + val = v.atoi() if val not in (0, 1): raise ValueError, 'Not a boolean: %s' % v return val def optionxform(self, optionstr): - return string.lower(optionstr) + return optionstr.lower() def has_option(self, section, option): """Check for the existence of a given option in a given section.""" @@ -419,14 +419,14 @@ class ConfigParser: break lineno = lineno + 1 # comment or blank line? - if string.strip(line) == '' or line[0] in '#;': + if line.strip() == '' or line[0] in '#;': continue - if string.lower(string.split(line)[0]) == 'rem' \ + if line.split()[0].lower() == 'rem' \ and line[0] in "rR": # no leading whitespace continue # continuation line? if line[0] in ' \t' and cursect is not None and optname: - value = string.strip(line) + value = line.strip() if value: cursect[optname] = cursect[optname] + '\n ' + value # a section header or option header? @@ -455,10 +455,10 @@ class ConfigParser: if vi in ('=', ':') and ';' in optval: # ';' is a comment delimiter only if it follows # a spacing character - pos = string.find(optval, ';') + pos = optval.find(';') if pos and optval[pos-1] in string.whitespace: optval = optval[:pos] - optval = string.strip(optval) + optval = optval.strip() # allow empty values if optval == '""': optval = '' |