python中的基础知识

print(数量{0}……),这个{0}啥意思
还有一种数量%4d,又是啥意思

两种都是python输出的参数占位形式

# {0}后面要接.format(参数),{0}表示取format中的第一个参数替换到print中
print('{0} {1}'.format('hello','world')) 
# 打印:hello world

#设置每个变量宽度,且为右对齐
print("整型为%4d, 浮点型为%4.2f, 字符串为%4s" % (data, data2, data3))