Python中最简单快捷的输出方式

格式化输出最简单的方式之哑巴填充公式

name=ludundun

age=25

print(f'hello {name},your age is {age}')

输出内容:

hello ludundun,your age is 25 

 

Sally=6.66666666

print(f'your Sally is {Sally:.3f}')

精确获取小数点后三位进行结果输出。

输出内容:

your Sally is 6.667

 

posted @ 2019-07-28 19:41  大海一个人听  阅读(579)  评论(0编辑  收藏  举报