summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1991-08-16 13:29:03 (GMT)
committerGuido van Rossum <guido@python.org>1991-08-16 13:29:03 (GMT)
commit333c2e02d04b2c15b739366c4cc93376dbcdce38 (patch)
treed3b33e4642247236044c03d9152daab7b98fb82c /Lib
parent7045dd04d760105f9ddcc23fad1939c3a071f4bc (diff)
downloadcpython-333c2e02d04b2c15b739366c4cc93376dbcdce38.zip
cpython-333c2e02d04b2c15b739366c4cc93376dbcdce38.tar.gz
cpython-333c2e02d04b2c15b739366c4cc93376dbcdce38.tar.bz2
A plus is also a sign!
Diffstat (limited to 'Lib')
-rw-r--r--Lib/string.py4
-rw-r--r--Lib/stringold.py4
2 files changed, 4 insertions, 4 deletions
diff --git a/Lib/string.py b/Lib/string.py
index c245a49..1c45ab3 100644
--- a/Lib/string.py
+++ b/Lib/string.py
@@ -142,6 +142,6 @@ def zfill(x, width):
n = len(s)
if n >= width: return s
sign = ''
- if s[0] = '-':
- sign, s = '-', s[1:]
+ if s[0] in ('-', '+'):
+ sign, s = s[0], s[1:]
return sign + '0'*(width-n) + s
diff --git a/Lib/stringold.py b/Lib/stringold.py
index c245a49..1c45ab3 100644
--- a/Lib/stringold.py
+++ b/Lib/stringold.py
@@ -142,6 +142,6 @@ def zfill(x, width):
n = len(s)
if n >= width: return s
sign = ''
- if s[0] = '-':
- sign, s = '-', s[1:]
+ if s[0] in ('-', '+'):
+ sign, s = s[0], s[1:]
return sign + '0'*(width-n) + s