欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

python命令行模式的用法及流程

 更新時(shí)間:2021年09月10日 08:34:51   作者:小妮淺淺  
在本篇文章里小編給大家整理的是一篇關(guān)于python命令行模式的用法及流程相關(guān)內(nèi)容,有興趣的朋友們可以跟著學(xué)習(xí)下。

1、使用cmd打開命令行窗口。

2、在輸入python時(shí),進(jìn)入python交互模式。

3、輸入exit(),退出交互模式,在命令行模式下運(yùn)行.py程序。

實(shí)例

C:\Users\86178>python
Python 3.8.3 (default, Jul 2 2020, 17:30:36) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> edit
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'edit' is not defined
>>> exit()

C:\Users\86178>python
Python 3.8.3 (default, Jul 2 2020, 17:30:36) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> hello.py
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'hello' is not defined
>>> exit()

C:\Users\86178>python hello.pu
python: can't open file 'hello.pu': [Errno 2] No such file or directory

C:\Users\86178>python hello.py
python: can't open file 'hello.py': [Errno 2] No such file or directory

C:\Users\86178>cd /d
文件名、目錄名或卷標(biāo)語(yǔ)法不正確。

C:\Users\86178>cd /d D:

D:\>python hello.py
hello
D:\>python
Python 3.8.3 (default, Jul 2 2020, 17:30:36) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> hello.py
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'hello' is not defined
>>>

知識(shí)點(diǎn)擴(kuò)充:

命令行模式與python交互模式

1.在命令行模式下,可以執(zhí)行 python 進(jìn)入 Python 交互式環(huán)境,也可以執(zhí)

行 python hello.py 運(yùn)行一個(gè).py 文件。

2.在 Python 交互式環(huán)境下,只能輸入 Python 代碼并立刻執(zhí)行。

3.Python 交互式環(huán)境會(huì)把每一行 Python 代碼的結(jié)果自動(dòng)打印出來(lái),但是,直接運(yùn)行 Python 代碼卻不會(huì)。

到此這篇關(guān)于python命令行模式的用法及流程的文章就介紹到這了,更多相關(guān)python命令行模式的使用流程內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論