py格式化输出
━━━━━━━━━━━━━━━━━━━━━━━━━
方式一:使用百分号(%)字符串格式化
print("my name is %s, and my age is %d" %(name,age))
方式二:使用format字符串格式化
位置参数:
print("my name is {}, and my age is {}".format(age,name))
关键字参数:
print("my name is {name}, and my age is {age}".format(age=18,name="jack"))
注释:位置参数("{0}".format()),关键字参数("{关键字}".format())
标签:输出,格式化,name,format,python,age,print,my From: https://www.cnblogs.com/nxhujiee/p/17503949.html