py#f-string


问题描述:字符串前面加f

例子:

k=1
print(f'string{k}')

[Out]   string1

作用:格式化 { }内的内容,{ }外的字符串常规输出,如要输出符号{ },则需双层 {{ }} 将输出内容包括起来。

相关