[New-bugs-announce] [issue13811] In str.format an incorrect alignment option doesn't make fill char and onself absent

py.user report at bugs.python.org
Wed Jan 18 01:54:04 CET 2012


New submission from py.user <port139 at yandex.ru>:

http://docs.python.org/py3k/library/string.html#format-specification-mini-language

"The fill character can be any character other than ‘{‘ or ‘}’. The presence of a fill character is signaled by the character following it, which must be one of the alignment options. If the second character of format_spec is not a valid alignment option, then it is assumed that both the fill character and the alignment option are absent."


>>> '{0:x>10d}'.format(1)
'xxxxxxxxx1'
>>> '{0:xx10d}'.format(1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: Invalid conversion specification
>>>

----------
messages: 151505
nosy: py.user
priority: normal
severity: normal
status: open
title: In str.format an incorrect alignment option doesn't make fill char and onself absent

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13811>
_______________________________________


More information about the New-bugs-announce mailing list