[New-bugs-announce] [issue9780] fill character cannot be '{'
Florent Xicluna
report at bugs.python.org
Mon Sep 6 02:11:23 CEST 2010
New submission from Florent Xicluna <florent.xicluna at gmail.com>:
According to the documentation:
"The fill character can be any character other than ‘}’ (which signifies the end of the field)."
http://docs.python.org/dev/library/string.html#format-specification-mini-language
However the format() builtin accepts both '{' and '}' characters:
>>> format(42, '}^6')
'}}42}}'
>>> format(42, '{^6')
'{{42{{'
And the string method rejects both characters.
>>> '{:}^6}'.format(42)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: Single '}' encountered in format string
>>> '{:{^6}'.format(42)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: unmatched '{' in format
----------
assignee: docs at python
components: Documentation
messages: 115678
nosy: docs at python, flox
priority: normal
severity: normal
stage: needs patch
status: open
title: fill character cannot be '{'
type: behavior
versions: Python 2.7, Python 3.1, Python 3.2
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9780>
_______________________________________
More information about the New-bugs-announce
mailing list