在任何语言中,输入和输出都是代码最基础的开始,
so,先来聊一聊输入和输出
输出
在python中,我们一般用print() 输出,在括号里输入你想输出的信息,用引号包裹起来(单双三都可以),例如我们来输出一个’hello,python’
>>>print('hello,python')
>>>hello,python
>>>print("hello,python")
>>>hello,python
如果要输出多个字符串,可以这样做:用逗号隔开的话每个字符串中间会以空格分隔
>>>print('hello', 'world', 'python')
>>>hello world python
也可以这样做,用加号连接的话每个字符串之间没有任何连接符,直接放在了一起
>>>print('hello' + 'world' + 'python')
>>>helloworldpython
print还可以用来输出数字—输出数字的时候不用加引号包裹
>>>print(20)
>>>20
也可用来计算数字之间的算数运算
>>>print(20 + 20)
>>>40
关于print有两个常用的内置方法
end会在输出内容的最后加上指定的字符,其实如果不指定end的值的话,默认为换行符也就是\n。所以pri