diff options
author | Guido van Rossum <guido@python.org> | 1999-10-11 22:15:41 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1999-10-11 22:15:41 (GMT) |
commit | 1b7aec35c43360ed1ec699458cc103e3223aac14 (patch) | |
tree | a83977c38a24f3ca78b2b661ea83a7d63a2c84ee | |
parent | 42636dc64d098ab034980e7c3e2bb2e056db3fb7 (diff) | |
download | cpython-1b7aec35c43360ed1ec699458cc103e3223aac14.zip cpython-1b7aec35c43360ed1ec699458cc103e3223aac14.tar.gz cpython-1b7aec35c43360ed1ec699458cc103e3223aac14.tar.bz2 |
Fix PR#31 -- zfill() mishandles empty string.
-rw-r--r-- | Lib/string.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/string.py b/Lib/string.py index 92158ee..e449c20 100644 --- a/Lib/string.py +++ b/Lib/string.py @@ -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 |