A plus is also a sign!

This commit is contained in:
Guido van Rossum 1991-08-16 13:29:03 +00:00
parent 7045dd04d7
commit 333c2e02d0
2 changed files with 4 additions and 4 deletions

View 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

View 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