[New-bugs-announce] [issue13971] format() doesn't parse str.

umedoblock report at bugs.python.org
Wed Feb 8 19:44:23 CET 2012


New submission from umedoblock <umedoblock at gmail.com>:

format() mis understaning.
please pay attention to [0], [x].

>>> d = {0: "a", "0": "A"}
>>> 'd[0] = {0[0]}'.format(d)
'd[0] = a'
>>> 'd[0] = {0["0"]}'.format(d)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: '"0"'
>>> d2 = {"x": 100}
>>> 'd2[x] = {0[x]}'.format(d2)
'd2[x] = 100'

----------
components: Regular Expressions
messages: 152897
nosy: ezio.melotti, umedoblock
priority: normal
severity: normal
status: open
title: format() doesn't parse str.
type: behavior
versions: Python 3.2

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


More information about the New-bugs-announce mailing list