From: Guido van Rossum Date: Fri, 16 Aug 1991 13:29:03 +0000 (+0000) Subject: A plus is also a sign! X-Git-Tag: v0.9.8~818 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=333c2e02d04b2c15b739366c4cc93376dbcdce38;p=thirdparty%2FPython%2Fcpython.git A plus is also a sign! --- diff --git a/Lib/string.py b/Lib/string.py index c245a493af66..1c45ab3b865b 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 c245a493af66..1c45ab3b865b 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