str.format():格式化字符串的函数,通过{} 和 :来代替以前的 % 。
str.format()用法说明 格式化字符串的函数 str.format(),它增强了字符串格式化的功能。
基本语法是通过{} 和 :来代替以前的 % 。【真的巨巨巨方便】
【例】
str.format()可以接受不限个参数,位置可以不按顺序。
str.format()可以设置参数、通过字典设置参数、通过列表索引设置参数
可以向 str.format() 传入对象
1、精度格式化
2、b、d、o、x分别是二进制、十进制、八进制、十六进制
3、以逗号分隔的数字、百分比格式、指数记法
https://blog.csdn.net/qq_34243930/article/details/106531570