MrNobody
MrNobody

Reputation: 19

Is it possible to do lazy formatting of a python string?

Instead of creating a normal formatted string:

s = f"{1+1}" # Which would be "2"

I am receiving a variable with the string "{1+1}" and I need to calculate the expressions inside curly braces to end up with the literal value "2" on the python script.

Does Python have any built-in logic to perform this operation?

Upvotes: 0

Views: 23

Answers (0)

Related Questions