如何将经典string转换为f-string?:
variable = 42
user_input = "The answer is {variable}"
print(user_input)
Run Code Online (Sandbox Code Playgroud)
答案是{变量}
f_user_input = # Here the operation to go from a string to an f-string
print(f_user_input)
Run Code Online (Sandbox Code Playgroud)
答案是42