格式化输出

#格式化输出

% 占位符

s 字符串   d digit数字

msg = "我叫%s, 今年%s, 身高%s" %(name,age,height)

 

python中单引号、双引号只能在一行中使用,遇到跨行的情况就要用到三引号。

 

 想要在格式化输入里面输入百分之多少,需要在%前面加一个%转义

 
 
posted @ 2020-09-07 14:40  温柔他  阅读(183)  评论(0)    收藏  举报