python簡介以及簡單程式碼——python學習筆記(一)
阿新 • • 發佈:2020-07-30
學習來源:https://www.liaoxuefeng.com/wiki/1016959663602400
python——解釋型語言;C——編譯型語言
開啟命令列輸入python進入python互動模式,即可開始輸入python程式碼,結束後輸入exit()並回車退出python互動模式回到命令列模式。
也可在win10輸入idle直接進入python互動模式。
兩個簡單程式碼:
(print()函式內單引號和雙引號均允許使用,注意不要混用)
>>>100+200 300
>>>print('hello python') hello python
>>>print("hello python") hello python
用
exit()
退出python,有一個遺憾是程式沒有儲存下來,下次執行時還要再次輸入程式碼。
程式執行後沒有儲存下來,下次執行時還要再輸一遍程式碼。
在命令列模式下輸入命令
python
進入python互動模式,也可以執行
python hello.py
執行一個.py檔案。
執行一個.py檔案只能在命令列模式執行。
在python互動模式下輸入
exit()
退出python互動模式,回到命令列模式