How do I convert a string into an f-string?
问题 I was reading this blog on python's new f-strings and they seem really neat. However, I want to be able to load an f-string from a string or file. I can't seem to find any string method or other function that does this. From the example in my link above: name = 'Fred' age = 42 f"My name is {name} and I am {age} years old" 'My name is Fred and I am 42 years old' But what if I had a string s ? I want to be able to eff-ify s , something like this: name = 'Fred' age = 42 s = "My name is {name}