说明:字符串:有序的,不可修改的,以引号包围的序列。
这里先来说一下占位符:
%s 字符串占位符
%d 数字占位符
%f 浮点型数字占位符
%.2f 控制浮点型数字占位符
举例:占位符的使用
print('this %s age is %d years old'%('boy',21))
> this boy age is 21 years old
%f 浮点型数字占位符
print('the boy height is %f m'%(1.8))
>>>the boy <weixin_38625448> 上传 | 大小:26kb