# 我的名字是xxx,年龄是xxx
print("我的名字是%s,年龄是%d"%(name, age))
# %[(name)][flags][width][.precision]typecode
# [ ]:代表可以省略
# (name)
# 表示,根据,制定的名称(key),查找对应的值,格式化到字符串中
mathScore = 59
englishScore = 58
print("我的数学分数是%(ms)d,英文的分数是%(es)d"%({"es":englishScore, "ms":mathScore}))
# width,表示,占用的宽度
print("%10d" % mathScore)
print("%-10d" % mathScore)
print("% 10d" % mathScore) 不管是一个空格还是两个空格,输出都是一个空格
#填充
#精度
#当字符串中存在格式化标志时,需要用%%表示一个百分号
#format使用
print("我的名字是{0},年龄是{1}".format(name, age))
#输出到文件中
f = open("test.txt", "w")
print("xxxxxx", file = f)
#输出不自动换行
print("abc", end = "")
#输出各个数据,使用分隔符进行分割
print("1", "2", "3", sep = "=")
1=2=3