濮阳杆衣贸易有限公司

主頁(yè) > 知識(shí)庫(kù) > python命令行模式的用法及流程

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

熱門標(biāo)簽:徐州天音防封電銷卡 哈爾濱外呼系統(tǒng)代理商 電話機(jī)器人適用業(yè)務(wù) 鄭州智能外呼系統(tǒng)運(yùn)營(yíng)商 獲客智能電銷機(jī)器人 不錯(cuò)的400電話辦理 南昌辦理400電話怎么安裝 佛山防封外呼系統(tǒng)收費(fèi) 湛江電銷防封卡

1、使用cmd打開(kāi)命令行窗口。

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)文章希望大家以后多多支持腳本之家!

您可能感興趣的文章:
  • 對(duì)命令行模式與python交互模式介紹

標(biāo)簽:安康 呂梁 紹興 蕪湖 蘭州 懷化 吉安 廣西

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《python命令行模式的用法及流程》,本文關(guān)鍵詞  python,命令行,模式,的,用法,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《python命令行模式的用法及流程》相關(guān)的同類信息!
  • 本頁(yè)收集關(guān)于python命令行模式的用法及流程的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    达孜县| 凭祥市| 山西省| 达州市| 宁南县| 新泰市| 台南县| 囊谦县| 兴城市| 会宁县| 宁阳县| 二连浩特市| 靖江市| 武定县| 固镇县| 和田市| 拜城县| 石景山区| 盖州市| 淮安市| 全椒县| 松阳县| 和平区| 天津市| 仲巴县| 贺兰县| 丰都县| 弥渡县| 天等县| 桐庐县| 定边县| 高安市| 咸阳市| 连云港市| 遂昌县| 英超| 丽江市| 章丘市| 申扎县| 普洱| 梅河口市|