|
|
|
|
|
by tedmiston
3068 days ago
|
|
You can do cool nested calls with them too. >>> class A:
... def __init__(self):
... self.foo = 5
... def bar(self):
... return 'cake'
...
>>> a = A()
>>> f'{a.foo}'
'5'
>>> f'{a.bar()}'
'cake'
>>> x = {'b': 1, 'c': 2}
>>> f"{x['b']}"
'1'
|
|