Ken Kundert <then...@nurdletech.com> writes: > I tried adding k and v to the local namespace: > > ... > k = 6 > v = 9 > print(f'Email: {d:{{k}} {{v}}}') > > I still got: > > NameError: name 'k' is not defined
This is not what I get: Python 3.6.5 (default, May 11 2018, 13:30:17) [GCC 7.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> k=1 >>> v=2 >>> print(f'this is {{k}} and {{v}}') this is {k} and {v} >>> print(f'this is {k} and {v}') this is 1 and 2 >>> print(f'Email: {d:{{k}} {{v}}}') Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'd' is not defined ciao, lele. -- nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia. l...@metapensiero.it | -- Fortunato Depero, 1929. -- https://mail.python.org/mailman/listinfo/python-list