python f-string 如何将 {} 字符用于变量和字符串
python f-string how to use the {} character for a variable and as a string
data = f'"{name}": ' + "{" + tmp + "},"
我有这样一个字符串,但我需要这样才能将字符串 {} 用作变量或仅用作字符串。我需要为此做什么?
你需要双大括号
>>> print(f"{{}}")
{}
data = f'"{name}": ' + "{" + tmp + "},"
我有这样一个字符串,但我需要这样才能将字符串 {} 用作变量或仅用作字符串。我需要为此做什么?
你需要双大括号
>>> print(f"{{}}")
{}