Python变量print

输出字符串的时候:  print("要输出的字符串")

      print("I LOVE SCHOOL")
      I LOVE SCHOOL

输出数字:print number

      print 3

      3

      print(5 + 3)

       8

输出字符串连接:

  >>> print("hello" + "world")
helloworld

批量输出:

print("hello world\n" * 3)
hello world
hello world
hello world

扫描二维码关注公众号,回复: 2849756 查看本文章

python的变量不需要事先声明,直接给一个合法的名字赋值,这个变量就生成了。

>>> number=1
>>> print number
1

猜你喜欢

转载自blog.csdn.net/Makefilehoon/article/details/81278815