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;
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;
in python In the folder, we create another file named Python.sublime-commands, as shown in the figure;
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" }
After modification, we click save, we click "Tools/Bulid System/Python", as shown in the figure;
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;
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!