主页
Python
Python String format() 方法
demo_string_placeholder5
运行 ❯
×
更改方向
保存代码
更改主题
#Use "+" to always indicate if the number is positive or negative: txt = "The temperature is between {:+} and {:+} degrees celsius." print(txt.format(-3, 7))
The temperature is between -3 and +7 degrees celsius.