各位老铁们,大家好,今天由我来为大家分享print是什么意思?用法、例句,以及Python编程中的print详细使用方法的相关问题知识,希望对大家有所帮助。如果可以帮助到大家,还望关注收藏下本站,您的支持是我们最大的动力,谢谢大家了哈,下面我们开始吧!
print()方法用于打印输出,是python中最常见的一个函数。
print(*objects,sep="",end="\\n",file=sys.stdout)
objects--表示输出的对象。输出多个对象时,需要用,(逗号)分隔。
end--用来设定以什么结尾。默认值是换行符\\n,我们可以换成其他字符。
#print("hello""world")
#print("hello","world")
#print("www","9iphp","cn",sep=".")
#hello="thelengthof%sis%d"%("hello",len("hello"))
#print("PI=%.*f"%(3,PI))
#print("PI=%*.3f"%(10,PI))
#print("恭喜{}获得{}分".format("亮仔",100))
#print("{score}分由{name}获得".format(name="亮仔",score=100))
#print("{}{}".format("hello","world"))
#print("{0}{1}".format("hello","world"))
#print("{0}{1}{0}".format("hello","world"))
#print("{a}{tom}{a}".format(tom="hello",a="world"))
#print("{}and{}".format("hello","world"))
#取10位左对齐,取10位右对齐(>)
#print("{:<10s}and{:>10s}".format("hello","world"))
#print("{:^10s}and{:^10s}".format("hello","world"))
#print("{}is{:.2f}".format(1.123,1.123))
#print("{0}is{0:>10.2f}".format(1.123))
#print("|{:0>2d}|".format(i))
#print("|{:02}|".format(i))
关于print是什么意思?用法、例句的内容到此结束,希望对大家有所帮助。