sh_08_格式化字符串

女爷i 2023-06-04 15:54 36阅读 0赞

sh_08_格式化字符串

  1. info_tuple = ("小明", 21, 1.85)
  2. # 格式化字符串后面的 `()` 本质上就是元组
  3. print("%s 年龄是 %d 身高是 %.2f" % info_tuple)
  4. info_str = "%s 年龄是 %d 身高是 %.2f" % info_tuple
  5. print(info_str)

转载于:https://www.cnblogs.com/shaohan/p/11519356.html

发表评论

表情:
评论列表 (有 0 条评论,36人围观)

还没有评论,来说两句吧...

相关阅读