python命令行模式如何使用
这篇文章主要讲解了“python命令行模式如何使用”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“python命令行模式如何使用”吧!
1、使用cmd打开命令行窗口。
2、在输入python时,进入python交互模式。
3、输入exit(),退出交互模式,在命令行模式下运行.py程序。
实例
C:\Users\86178>pythonPython3.8.3(default,Jul22020,17:30:36)[MSCv.191664bit(AMD64)]::Anaconda,Inc.onwin32Type"help","copyright","credits"or"license"formoreinformation.>>>editTraceback(mostrecentcalllast):File"<stdin>",line1,in<module>NameError:name'edit'isnotdefined>>>exit()C:\Users\86178>pythonPython3.8.3(default,Jul22020,17:30:36)[MSCv.191664bit(AMD64)]::Anaconda,Inc.onwin32Type"help","copyright","credits"or"license"formoreinformation.>>>hello.pyTraceback(mostrecentcalllast):File"<stdin>",line1,in<module>NameError:name'hello'isnotdefined>>>exit()C:\Users\86178>pythonhello.pupython:can'topenfile'hello.pu':[Errno2]NosuchfileordirectoryC:\Users\86178>pythonhello.pypython:can'topenfile'hello.py':[Errno2]NosuchfileordirectoryC:\Users\86178>cd/d文件名、目录名或卷标语法不正确。C:\Users\86178>cd/dD:D:\>pythonhello.pyhelloD:\>pythonPython3.8.3(default,Jul22020,17:30:36)[MSCv.191664bit(AMD64)]::Anaconda,Inc.onwin32Type"help","copyright","credits"or"license"formoreinformation.>>>hello.pyTraceback(mostrecentcalllast):File"<stdin>",line1,in<module>NameError:name'hello'isnotdefined>>>
感谢各位的阅读,以上就是“python命令行模式如何使用”的内容了,经过本文的学习后,相信大家对python命令行模式如何使用这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是,小编将为大家推送更多相关知识点的文章,欢迎关注!