输入的函数形式共有两种,即为print( ),print‘ ‘
>>> print("python is the best")
python is the best
>>> print("python is the best","python csn did it","bruce is best")
('python is the best', 'python csn did it', 'bruce is best')
输入的函数是print‘ ‘这种格式中各个变量是由逗号拼接起来的,比如下面前两行代码。Print函数还可以将字符与计算结果一起打印出来,比如第三行代码。Python中可以进行通过函数 raw_input()外部输入字符,比如第四行代码。
>>> print 'df'
df
>>> print 'i','practice','python'
i practice python
>>> print "54+100=",54 + 100
54+100= 154
>>> name = raw_input()
python
>>> name
'python'
备注:
python2.7与python3.x在输出上存在一定的区别
Python2.7运行的结果为
>>> print('100 + 200 =', 100 + 200)
('100 + 200 =', 300)
Python3.x运行的结果为
>>> print('100 + 200 =', 100 + 200)
100+ 200 = 300