Sublime sample code for python program development, sublimepython
This article introduces the sample code for Sublime to develop a python program. The details are as follows:
Download and install Python programs
Https://www.python.org/downloads/
Download and install sublime
Http://www.sublimetext.com/
Associate python
Preferences-> Browers Packages-> Python. sublime-build
Modify the Python. sublime-build File and 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 can be said to be a plug-in that must be installed, because it provides a convenient function to install, upgrade, and delete the Sublime plug-in.
Use the shortcut key ctrl + shift + p (Win, Linux) or cmd + shift + p (OS X), where commands starting with Package Control, the most common commands are Package Control: Install Package, Package Control: Remove Package, and Package Control: List Packages.
Installation Procedure: choose view> Show Console. Open the Console and paste the code of the corresponding version and press Enter.
Applicable to 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())
Applicable to 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 plug-in python code auto-completion plug-in (jedi)
Ctrl + shift + p open Package Control, enter Install Package and press enter, and enter jedi
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.