控制台输入有两个函数
1. raw_input()
该函数把所有输入都转为字符串型
2.input()
输入的内容保持原本的数据类型。
比如输入1,就是整型1;
输入‘1’,就是字符串1。
举例对比:
a = raw_input("a=")
print type(a)
b = input("b=")
print type(b)
c = input("c=")
print type(c)
其中type()可以输出变量类型
结果:
该函数把所有输入都转为字符串型
输入的内容保持原本的数据类型。
比如输入1,就是整型1;
输入‘1’,就是字符串1。
举例对比:
a = raw_input("a=")
print type(a)
b = input("b=")
print type(b)
c = input("c=")
print type(c)
其中type()可以输出变量类型
结果: