I can use fstring with a dictionary:
mydict = {'foo': 'py', 'bar': 'thon'}
print(f"I am using {mydict['foo']}{mydict['bar']}")
> I am using python
I can also pad strings:
f"{'Foo': <16} Bar"
>'Foo Bar'
I want to be able to pad a string that's coming from my dictionary inside my fstring.
I have tried:
f"{{mydict['foo']}: <16} {mydict['bar']}"
The error here is:
File "", line 1
SyntaxError: f-string: single '}' is not allowed
Is this possible or do I have to add the padded string to my dictionary first before using?