1. 程式人生 > >Python2 與 Python3 區別

Python2 與 Python3 區別

Python2 中 print 用法為 print "Hello World"
Python3 中 print 用法為 print("Hello World")

Python2 中的 input() 函式:獲取當前輸入的內容,並將其作為數字型別來處理
Python3 中的 input() 函式:獲取當前輸入的內容,並將其作為字串型別來處理

Python2 中的 raw_input() 函式用於獲取當前輸入的內容,並將其作為字串型別來處理
Python3 中不再有 raw_input() 函式,使用 input() 函式來替代