]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
A plus is also a sign!
authorGuido van Rossum <guido@python.org>
Fri, 16 Aug 1991 13:29:03 +0000 (13:29 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 16 Aug 1991 13:29:03 +0000 (13:29 +0000)
Lib/string.py
Lib/stringold.py

index c245a493af669d33ca440f72cf29f06918ea0c9b..1c45ab3b865bf8e8cb2b3d3c65438d3709168b4f 100644 (file)
@@ -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
index c245a493af669d33ca440f72cf29f06918ea0c9b..1c45ab3b865bf8e8cb2b3d3c65438d3709168b4f 100644 (file)
@@ -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