一、 input输入函数
input函数:获取用户输入,保存成一个字符串。重要的话,说两遍,input函数的返回值是一个字符串类型。哪怕你输入的是个数字1,返回给你的只会是字符串“1”,而不是 整数1。下面是一些简单的展示例子:>>> inp = input("please input your name: ")
please input your name: jack
>>> inp
'jack'
>>> type(inp)
>>> age = input("please input your age: ")
please input your age: 18
>>> age
'18'
>>> type(age)
>>> a = input("请输入一个字符:")
请输入一个字符:
>>> a
''
>>> a = input("请输入一个字符:")
请输入一个字符: 前后带有空白
>>> a
' 前后带有空白 '
第一个例子中,inp = input(