主页
Python
Python String format() 方法
demo_string_placeholder1
运行 ❯
×
更改方向
保存代码
更改主题
#To demonstrate, we insert the number 8 to set the available space for the value to 8 characters. #Use "<" to left-align the value: txt = "We have {:<8} chickens." print(txt.format(49))
We have 49 chickens.