Home  >  Article  >  Backend Development  >  How to run python code program in sublime

How to run python code program in sublime

尚
Original
2019-07-04 11:20:3615727browse

How to run python code program in sublime

sublime is also a commonly used text editor. When we edit python files, we can configure it in the preferences to quickly run the python file;

We use sublime to open a python file, how do we run it, as shown in the figure;

How to run python code program in sublime

We click on "Preferences/Browse Packages" and click to open After that, a directory graphics window comes out. We find the python folder. If it doesn’t exist, we create a new one, as shown in the figure;

How to run python code program in sublime

How to run python code program in sublime

in python In the folder, we create another file named Python.sublime-commands, as shown in the figure;

How to run python code program in sublime

Then we write the following content, and replace the path line with yourself python installation path;

{
"cmd":["python.exe", "-u", "$file"],
"path":"D:\python3.6",
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python"
}

How to run python code program in sublime

After modification, we click save, we click "Tools/Bulid System/Python", as shown in the figure;

How to run python code program in sublime

Then we go back to the previous python file, we click "Tools/Bulid" (the shortcut key is Ctrl B, press the shortcut key later), you can see the results of the operation, as shown in the figure Display;

How to run python code program in sublime

How to run python code program in sublime

For more Python related technical articles, please visit the Python Tutorial column to learn!

The above is the detailed content of How to run python code program in sublime. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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
Previous article:What is demo in pythonNext article:What is demo in python