- 使用Python(command line)即下載下傳python自帶的解釋器,請注意區分指令行模式和Python互動模式,在指令行模式下,可以執行
進入Python互動式環境,也可以執行python
運作一個python hello.py
檔案,但是在Python互動式環境下,隻能輸入Python代碼執行,不能直接執行一個檔案!.py
- print輸出,列印多個變量需要加上逗号!Python提供了一個
,可以讓使用者輸入字元串,并存放到一個變量裡。列印出raw_input
變量的内容,除了直接寫name
然後按回車外,還可以用name
語句。print
-
name = raw_input('please enter your name: ') print 'hello,', name
please enter your name: Michael
hello, Michael