If you cannot exit the Python prompt during Python running or encounter some difficulties during related operations, you can use our article to learn about how to exit the Python prompt during Python running, and hope you will gain some benefits.
If you are using Linux/BSD shell, press Ctrl-d to exit the prompt. If it is in Windows command line, press Ctrl-z and then press Enter.
Select an editor
Before writing a Python program as a source file, we need an editor to write the source file. Selecting an editor is really important. You can select an editor just like you can select a car you will buy. A good editor will help you easily write Python programs, make your programming journey more comfortable, and help you reach your destination more quickly and securely ).
One of the basic requirements for the editor is the syntax brightening function. With this function, different parts of your Python running program are marked in different colors, in this way, you can better understand your program and visualize its operation.
If you are using Windows, we recommend that you use IDLE. IDLE has the syntax brightening function and many other functions, such as allowing you to run your program in IDLE. Note: Do not use Notepad-it is a bad choice, because it does not have the syntax brightening function, and more importantly, it does not support text indentation. We will see that text indentation is extremely important to us. A good editor, such as IDLE and VIM, will automatically help you do these tasks.
- Introduction to three types of Python types
- How to Implement element variables in the Python list
- The Python splitter teaches you how to operate on an article.
- How to run the Hello World Program in Python
- Two import methods for the Python Module
If you use Linux/FreeBSD, you have many options. If you are an experienced programmer, you must be using VIM or Emacs. Undoubtedly, they are two of the most powerful editors. You will benefit from using them to write your Python program. I personally use VIM to write most of my programs.
If you are a beginner in programming, you can use Kate, which is also one of my favorite editors. As long as you are willing to spend time learning to use VIM or Emacs, I strongly recommend that you learn either of them, because they are extremely helpful in the long run.
Use source files
Now let's start programming again. When you learn a new programming language, the first program you write and run is usually a "Hello World" program, which has become a tradition. When you run the "Hello World" program, all it does is say "Hello World ". As Simon Cozens, who proposed the "Hello World" program, said, "It is a traditional spell of the god of programming and can help you better learn languages ."
Start the editor you selected, enter the following program, and save it as helloworld. py.
Example 2 use source files
- #!/usr/bin/python
- # Filename : helloworld.py
- print 'Hello World'
-
The above content is a brief introduction to some application operations on how to exit the Python prompt.