python 使用f-string在Python中打印变量值

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 使用f-string在Python中打印变量值相关的知识,希望对你有一定的参考价值。

a = 2
b = 'Test'
print(f"a is {a} and b is {b}")

以上是关于python 使用f-string在Python中打印变量值的主要内容,如果未能解决你的问题,请参考以下文章

在 Python 格式(f-string)字符串中,!r 是啥意思? [复制]

百分之九十的人不知道?在Python中f-string的几个技巧

python3.6使用f-string来格式化字符串

SyntaxError: f-string: 在 python 中期待 ''

效率倍增!这4个F-strings 的 Python 小技巧太棒了!

python3 f-string格式化字符串的高级用法