r...@zedat.fu-berlin.de (Stefan Ram) writes: > Meredith Montgomery <mmontgom...@levado.to> writes: > ... >> d = { "name": "Meredith", "email": "mmontgom...@levado.to" } >> return "The name is {name} and the email is {email}".format(**d) >>--8<---------------cut here---------------end--------------->8--- >>Is there a way to do this with f-strings? > > I cannot think of anything shorter now than: > > eval( 'f"The name is {name} and the email is {email}"', d ) > > , but with the spaces removed, it's even one character > shorter than the format expression: > > eval('f"The name is {name} and the email is {email}"',d) > "The name is {name} and the email is {email}".format(**d) > > .
Lol. That's brilliant! Thanks very much! -- https://mail.python.org/mailman/listinfo/python-list