Home > Development Tools > notepad > How to configure Python in notepad

How to configure Python in notepad

爱喝马黛茶的安东尼
Release: 2019-08-16 15:35:31
Original
5155 people have browsed it

How to configure Python in notepad

1. First, select Python in the language.

2. Then click Run and enter in the pop-up dialog box:
cmd /k cd /d "$(CURRENT_DIRECTORY)" & python "$(FULL_CURRENT_PATH)" & ECHO. & PAUSE & EXIT
Then click Save, enter the name of the shortcut key, such as RunPython, and then define the shortcut key, such as ctrl f5. After writing the code in this way, just press ctrl f5 to run the program.

Related recommendations: "Notepad using graphic tutorial"

Explanation:
cmd /k means to open the cmd command line, and then run the /k command In the command
Cd /d "$(CURRENT_DIRECTORY)":
CD command represents switching the current working directory
/d is a parameter of CD command, which means that when the directory to be switched is not in the same partition, it is required Add /d, otherwise the cd will fail.
$(CURRENT_DIRECTORY) represents the directory where the current source program file is located
& is used to connect two commands and execute them sequentially
Python: Since the path has been set in the environment variable before, python can be run directly to python. exe
$(FULL_CURRENT_PATH) refers to the full path of the current file
echo: newline
pause: indicates pausing after the run is completed (cmd displays "Please press any key to continue. . ."), waiting for a key to continue
exit: Close the command line window after meaning "Press any key to continue...".

3. Since python is a language that is sensitive to spaces and indentation, relevant settings must be made.
First set the tab to 4 spaces,
Select Settings->Preferences->Language, select the right side, the tab width is 4, and select Replace with spaces.
Select Settings->Preferences->New, select encoding in utf-8 no BOM format.

The above is the detailed content of How to configure Python in notepad. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template