print(数量{0}……),这个{0}啥意思
还有一种数量%4d,又是啥意思
特殊的使用Format格式可以使用索引,还可以使用句点表示法来访问导入的模块中的方法、属性、变量和函数。例:
print("{}, {} and {}".format('First','Second','Three'))
print("{1}, {0} and {2}".format('First','Second','Three'))
print("{Variable} is approximately {value:4.1f}".format(value = 3.14,Variable=3.1415))
First, Second and Three
Second, First and Three
3.1415 is approximately 3.1
而%4d表示输出的结果右对齐,取四位,不足四位前面补空格。
有帮助的话采纳一下哦!