控制檯輸入有兩個函數
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()可以輸出變量類型
結果: