格式化输出
print(format(value,format_spec)),其中3为打印位数,2f为精度
print(format(12.2356, ‘3.2f‘)) print(format(0.23456,‘.1%‘)) D:\Python27\python.exe F:/Self-Study/python-study/input_output.py 12.24 23.5%
python学习笔记-输入输出
时间: 2024-10-07 00:39:46
格式化输出
print(format(value,format_spec)),其中3为打印位数,2f为精度
print(format(12.2356, ‘3.2f‘)) print(format(0.23456,‘.1%‘)) D:\Python27\python.exe F:/Self-Study/python-study/input_output.py 12.24 23.5%
python学习笔记-输入输出