Sublime develops sample code for the python program
- 2020-07-21 09:03:27
- OfStack
This article introduced Sublime development python program sample code, to share with you, specific as follows:
Download and install the Python program
https://www.python.org/downloads/
Download and install sublime
http://www.sublimetext.com/
Associated python
Preferences-
>
Browers Packages -
>
Python -
>
Python.sublime-build
Modify the ES32en. sublime-ES34en file to add the python installation path
{
"cmd": ["python", "-u", "$file"],
"path":"D:\Python33",
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python"
}
Install Package Control
Sublime Package Control is a must-install because it provides easy access to install/upgrade/remove Sublime plug-ins
Using the shortcut key ctrl+shift+p (Win, Linux) or cmd+shift+p (OS X), the commands beginning with Package Control: are related to Package Control: Install Package, Package Control: Remove Control: List Packages.
Installation steps: view-
>
Open the console from the Show Console menu and paste the corresponding version of the code enter
For Sublime Text 3:
import urllib.request,os;
pf='Package Control.sublime-package';
ipp=sublime.installed_packages_path();
urllib.request.install_opener(urllib.request.build_opener(urllib.request.ProxyHandler()));
open(os.path.join(ipp,pf),'wb').write(urllib.request.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read())
For Sublime Text 2:
import urllib2,os;
pf='Package Control.sublime-package';
ipp=sublime.installed_packages_path();
os.makedirs(ipp)ifnotos.path.exists(ipp)elseNone;
urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler()));
open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read());
print('Please restart Sublime Text to finish installation')
Install the plug-in python Code Autocomplete Plug-in (jedi)
ctrl+shift+p Open Package Control and enter Install Package enter, enter jedi