在Python中打印单个和多个变量

在里面 Python 3。十、 ,print语句写为 A. 打印() 作用下面是Python 3中的代码。显示了用Python打印值的过程。

null

示例1:打印单个值

Python3

# Equivalent codes in Python 3.0
# (Produces same output)
# Code 1:
print ( 1 )
# Code 2 :
print (( 1 ))


输出:

1 1

例2: 打印多个值

Python3

# Code 1:
print ( 1 , 2 )
# Code 2:
print (( 1 , 2 ))
# Code 3:
# printing on the same line
# for printing on the same line use
# end parameters of the print function
# end takes the values which is printing
# at the end of the output.
print ( 1 , end = " " )
print ( 2 )


输出:

1 2(1, 2)1 2

本文由 阿比特·阿加瓦尔 .如果你喜欢GeekSforgek,并想贡献自己的力量,你也可以写一篇文章,然后将文章邮寄给评论-team@geeksforgeeks.org.看到你的文章出现在Geeksforgeks主页上,并帮助其他极客。

如果您发现任何不正确的地方,或者您想分享有关上述主题的更多信息,请写评论

© 版权声明
THE END
喜欢就支持一下吧
点赞5 分享