Fix PR#31 -- zfill() mishandles empty string.

This commit is contained in:
Guido van Rossum 1999-10-11 22:15:41 +00:00
parent 42636dc64d
commit 1b7aec35c4
1 changed files with 1 additions and 1 deletions

View File

@ -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