How to use python command line mode
This article mainly introduces how to use the python command line model, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
1. Use cmd to open a command line window.
2. When entering python, enter python interaction mode.
3. Type exit (), exit the interactive mode, and run the .py program in the command line mode.
Example
C:\ Users\ 86178 > pythonPython 3.8.3 (default, Jul 2 2020, 17:30:36) [MSC v.1916 64 bit (AMD64)]:: Anaconda, Inc. On win32Type "help", "copyright", "credits" or "license" for more information. > > editTraceback (most recent call last): File ", line 1, in NameError: name 'edit' is not defined > > exit () C:\ Users\ 86178 > pythonPython 3.8.3 (default, Jul 2 2020) 17:30:36) [MSC v.1916 64 bit (AMD64)]:: Anaconda, Inc. On win32Type "help", "copyright", "credits" or "license" for more information. > > hello.pyTraceback (most recent call last): File ", line 1 In NameError: name 'hello' is not defined > > exit () C:\ Users\ 86178 > python hello.pupython: can't open file' hello.pu': [Errno 2] No such file or directory C:\ Users\ 86178 > python hello.pypython: can't open file 'hello.py': [Errno 2] No such file or directory C:\ Users\ 86178 > cd / d file name, directory name or volume label syntax is incorrect. C:\ Users\ 86178 > cd / d D: d:\ > python hello.pyhelloD:\ > pythonPython 3.8.3 (default, Jul 2 2020, 17:30:36) [MSC v.1916 64 bit (AMD64)]:: Anaconda, Inc. On win32Type "help", "copyright", "credits" or "license" for more information. > > hello.pyTraceback (most recent call last): File ", line 1, in NameError: name 'hello' is not defined > > Thank you for reading this article carefully. I hope the article "how to use the python Command Line Model" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!