[issue44683] String formatting
Mykyta
report at bugs.python.org
Tue Jul 20 08:58:24 EDT 2021
New submission from Mykyta <poberezhniyn at icloud.com>:
The formatting does not work correctly.
I have a dict with string representations of integers as keys, such as {'1': 'a'} and trying to format it this way: '{0[1]}' and KeyError occurs. But I think it should not as '{0[a]}'.format(a) works properly with a = {'a': '1'} and '{0[1]}'.format(a) works properly with a = {1: 'a'}. Adding quotation marks does not help, KeyError occurs with '"1"'.
----------
components: Unicode
files: 1.png
messages: 397867
nosy: NickP, ezio.melotti, vstinner
priority: normal
severity: normal
status: open
title: String formatting
type: behavior
versions: Python 3.9
Added file: https://bugs.python.org/file50166/1.png
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44683>
_______________________________________
More information about the Python-bugs-list
mailing list