summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1999-10-11 22:15:41 (GMT)
committerGuido van Rossum <guido@python.org>1999-10-11 22:15:41 (GMT)
commit1b7aec35c43360ed1ec699458cc103e3223aac14 (patch)
treea83977c38a24f3ca78b2b661ea83a7d63a2c84ee /Lib
parent42636dc64d098ab034980e7c3e2bb2e056db3fb7 (diff)
downloadcpython-1b7aec35c43360ed1ec699458cc103e3223aac14.zip
cpython-1b7aec35c43360ed1ec699458cc103e3223aac14.tar.gz
cpython-1b7aec35c43360ed1ec699458cc103e3223aac14.tar.bz2
Fix PR#31 -- zfill() mishandles empty string.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/string.py2
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