Fix PR#31 -- zfill() mishandles empty string.
This commit is contained in:
parent
42636dc64d
commit
1b7aec35c4
|
@ -475,7 +475,7 @@ def zfill(x, width):
|
|||
n = len(s)
|
||||
if n >= width: return s
|
||||
sign = ''
|
||||
if s[0] in ('-', '+'):
|
||||
if s[:1] in ('-', '+'):
|
||||
sign, s = s[0], s[1:]
|
||||
return sign + '0'*(width-n) + s
|
||||
|
||||
|
|
Loading…
Reference in New Issue