When you install python, you can write statements in the python environment.
There are two ways to open the python environment: the first way is to find and open python.exe in the python folder; the second way is to search and enter cmd in the Windows system, enter the command line mode, and enter python (provided that it has been configured Environment variables). One feature of the python environment is that there are three greater than signs in front of each input line. In the python environment, you can enter a short python command and press Enter to get feedback.
But if you want to write an independent larger python file, you can right click to create a new txt file, and then change the .txt suffix to .py. When selecting the opening method, select IDLE mode to edit. For convenience, you can right-click to select properties, change the opening mode, and select IDLE as the default opening mode, you can double-click to open and enter the editing page. If you want to run on the editing page, click f5 To run.
Note: Notepad++ cannot be used, HTML can be used, but python files are not!
Some children's shoes want to run the python file directly, you can use the cmd command line, first switch to the file path to be run, enter the python file name, and then print the result in the command line window.
Some students directly use python.exe to open the py file, and a black window will flash by at this time. This is because it executes the command very quickly. If there is no result left, it will flash back. . In response to this situation, there are several opening methods for children's shoes to choose from.
1、 You can use the eclipse tool to open,
2、 Add an input() directly after the py file,
3、 Download appium/python-client and run the program directly.
Knowledge point expansion:
CMD cannot run python program to solve
Methods as below.
1、 Open a text editor, recommend editplus, notepad, etc., save the file in .py format, editplus and notepad support python syntax recognition. Be sure to write #!usr/bin/python on the first line of the script, indicating that the script file is an executable python script. If your python directory is not in the usr/bin directory, replace it with the current python executable directory.
2、 Pay attention to debugging after writing the script, you can directly use editplus to debug. The debugging method can be Baidu. After the script is written, open the CMD command line, provided that python has been added to the environment variable.
3、 In the CMD command line, enter "python" + "space", that is, "python"; drag the script file that has been written to the current cursor position, and then press Enter to run.
So far, this article on how python handles the program can’t be opened is introduced. For more related python programs can’t be opened, please search for the previous articles of ZaLou.Cn or continue to browse the related articles below. Hope you will support more in the future ZaLou.Cn!
Recommended Posts