Python是有提供输入和输出的函数的print输出input输入(raw_input)
print
>>> print('hello word')
hello word
>>> print("hello word")
hello word
>>>
用print()在括号里加上字符串,就可以向屏幕上输出指定的文字。
print也可以打印整数
>>> print(300)
300
>>> print(300 + 100)
400
>>> print('100 + 200 =', 100 + 200)
100 + 200 = 300
用单引号引起来的是字符串所以python解释器会原样输出。后面的没有引号所以会把他当成一个算式来计算
input
如果我们想让用户输入要打印的东西那么就要用到input
>>> cao = input('请输入:');print(cao)
请输入:1
1
>>>
从用户的输入获取到cao的值,在打印cao分号上一条语句的结束符号
转载于:https://blog.51cto.com/caojiaoyue/1945908