diff options
author | Guido van Rossum <guido@python.org> | 1992-01-01 19:35:13 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1992-01-01 19:35:13 (GMT) |
commit | bdfcfccbe591e15221f35add01132174c9b4e669 (patch) | |
tree | 7e5f0d52b8c44e623b12e8f4b5cd645c361e5aeb /Lib/string.py | |
parent | 4d8e859e8f0a209a7e999ce9cc0988156c795949 (diff) | |
download | cpython-bdfcfccbe591e15221f35add01132174c9b4e669.zip cpython-bdfcfccbe591e15221f35add01132174c9b4e669.tar.gz cpython-bdfcfccbe591e15221f35add01132174c9b4e669.tar.bz2 |
New == syntax
Diffstat (limited to 'Lib/string.py')
-rw-r--r-- | Lib/string.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/string.py b/Lib/string.py index 1c45ab3..1412048 100644 --- a/Lib/string.py +++ b/Lib/string.py @@ -56,7 +56,7 @@ def split(s): i, n = 0, len(s) while i < n: while i < n and s[i] in whitespace: i = i+1 - if i = n: break + if i == n: break j = i while j < n and s[j] not in whitespace: j = j+1 res.append(s[i:j]) @@ -71,7 +71,7 @@ def splitfields(s, sep): nsep = len(sep) i = j = 0 while j+nsep <= ns: - if s[j:j+nsep] = sep: + if s[j:j+nsep] == sep: res.append(s[i:j]) i = j = j + nsep else: @@ -98,7 +98,7 @@ index_error = 'substring not found in string.index' def index(s, sub): n = len(sub) for i in range(len(s) + 1 - n): - if sub = s[i:i+n]: return i + if sub == s[i:i+n]: return i raise index_error, (s, sub) # Convert string to integer @@ -137,7 +137,7 @@ def center(s, width): # Decadent feature: the argument may be a string or a number # (Use of this is deprecated; it should be a string as with ljust c.s.) def zfill(x, width): - if type(x) = type(''): s = x + if type(x) == type(''): s = x else: s = `x` n = len(s) if n >= width: return s |