python命令行模式的使用流程

python命令行模式的使用流程

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

2、在输入python时,进入python交互模式。

3、输入exit(),退出交互模式,在命令行模式下运行.py程序。

实例

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
文件名、目录名或卷标语法不正确。
 
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
>>>


微信扫描下方的二维码阅读更多精彩内容

python命令行模式的使用流程

每日分享到群里,或者推荐给朋友会得大量积分,机会可以兑换微信零钱红包,具体请点击这里,得到了微信红包可以用来支持大飞哥

大飞哥能不能加鸡腿就看各位了!

赞赏请扫

开发者微信

大飞哥微信

开发者微信反馈BUG或者VIP可以添加,其他情况反馈可能不及时,见谅

版权声明

初衷是提供高清手机电脑壁纸等图片素材免费分享下载,禁止商用。图片素材来源网络,版权归原作者所有,若有侵权问题敬请告知我们!

【友情提醒】:

因平台原因不易展示大尺度写真,有的写真展示越少代表此套写真越性感,特别是xiuren等写真每一套写真完整套图50-100张不等。更多内容的欣赏请移步 点击这里

【更多图集移步】: 每日更新-点击这里
漂亮小姐姐-点击这里
性感美女-点击这里
清纯女孩-点击这里
xiuren专栏-点击这里
整站资源下载-点击这里

相关新闻