古典string
をf-string
に変換するにはどうすればよいですか? :文字列をf-stringに変換する
variable = 42
user_input = "The answer is {variable}"
print(user_input)
回答は{変数}
f_user_input = # Here the operation to go from a string to an f-string
print(f_user_input)
ある答えは構文なく、オブジェクト型42
f-stringは**構文**であり、オブジェクトタイプではありません。テンプレートをその構文に変換することはできません。 –