1.打印字符串
print("My name is %s" %("Alfred.Xue"))#输出效果:My name is Alfred.Xue
2.打印整数
print("I am %d years old." %(25))#输出效果:I am 25 years old.
3.打印浮点数
print ("His height is %f m"%(1.70))#输出效果:His height is 1.700000 m
本文共 270 字,大约阅读时间需要 1 分钟。
1.打印字符串
print("My name is %s" %("Alfred.Xue"))#输出效果:My name is Alfred.Xue
2.打印整数
print("I am %d years old." %(25))#输出效果:I am 25 years old.
3.打印浮点数
print ("His height is %f m"%(1.70))#输出效果:His height is 1.700000 m
转载于:https://www.cnblogs.com/yanshuai0922/p/9852987.html