Python input和raw_input

python有多種從控制檯輸入方式: 
使用input()、raw_input()函數 
這兩個函數在python的內置庫裏。 
input()函數返回一個數值(整型或浮點型) 
raw_input()函數返回字符串 
用例

value = input('input a int:')
print value
hello = raw_input('input a string:')
print hello
  • 1
  • 2
  • 3
  • 4
  • 1
  • 2
  • 3
  • 4


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章