sh_08_格式化字符串

 

sh_08_格式化字符串

info_tuple = ("小明", 21, 1.85)

# 格式化字符串后面的 `()` 本质上就是元组
print("%s 年龄是 %d 身高是 %.2f" % info_tuple)

info_str = "%s 年龄是 %d 身高是 %.2f" % info_tuple

print(info_str)

 

posted @ 2019-09-14 15:56  俊豪郎  阅读(180)  评论(0编辑  收藏  举报