Selenium2+python Study notes (ii) Python editor Sublime

Source: Internet
Author: User
Tags sublime text

Sublime Text is a useful editor I found, it is not only support Python, support the current multi-mainstream programming language, shortcut key rich, can greatly improve the efficiency of code development.
Sublime Text Address: http://www.sublimetext.com/

Version selection: The difference between python,sublime text 3 for Sublime Text 2 is that it updates the Python function, the API is different, but ST2 is more stable than ST3.

The example in this article uses the editor as ST2

1 Installing the Python-related plug-in 1.1 Installing the package Control (a convenient plugin for managing sublime text management plug-ins) 1.1.1 Simple Method installation

From the menu View-show console or CTRL + ~ shortcut keys, bring up the console. Paste the following Python code in and enter to perform the installation without exception. The installation code for ST3 and ST2 is provided below:

Sublime Text 3:

ImportUrllib.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 ())

Sublime Text 2:

ImportUrllib2,os; pf='Package Control.sublime-package'; IPP=Sublime.installed_packages_path (); Os.makedirs (IPP)if  notOs.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('Restart Sublime Text to finish installation')
1.1.2 Manual Installation

You may not be able to use code installation for a variety of reasons, and you can manually install the package Control by using the following steps:

1) Click Preferences > Browse Packages menu

2) Enter the upper directory of the Open directory and then enter the installed packages/directory

3) Download the package control.sublime-package and copy it to the installed packages/directory (: Https://github.com/wbond/sublime_package_control)

4) Restart Sublime Text.

1.2 Installing other Python-related plugins

1) shortcut key ctrl+shift+p (menu –tools–command paletter), enter install select Install package and enter, type or select the plug-in you need to install the ( Note that the small text changes in the lower left corner will prompt the installation to succeed .

2) Install the Sublimecodeintel plug-in, you can implement the automatic grammar completion function.

3) Install AutoPEP8 to automatically normalize Python.

4) Focus on installing the SUBLIMEREPL plug-in, when installing open python files, switch the layout to 2-line Search, select the menu:


The following PDB debugging interface is then present.

Then you can output a variety of PDB commands for debugging. Like what:

(Pdb) b to #在31行建立断点

Breakpoint 1 at C:\work\code\workspace\test\sqlalchemy\docopt.py:31

(PDB) R #运行到断点处
> c:\work\code\workspace\test\sqlalchemy\docopt.py (+) <module> ()
M=myclass ()

(PDB) #在这个命令行下就可以执行当前上下文的python

The specific command please own Baidu

2 Script First Experience

After the Python-related environment is set up, run the first Selenium2+python script using Sublime Text 2

The steps are as follows:

1) Open the editor, File->new File, click on the lower right corner plain Text, change the scripting language to Python

2) Edit Script

3)ctrl+b Run script ( must be saved before running, otherwise it will be error )

3 Tips for using

1) After selecting the text, press TAB and SHIFT + TAB to control the indentation. The file is not saved and you can exit the program directly, and the next boot will be restored automatically.

2) Add a block comment, similar to/*/* * * * * * * * * with comments added in this way. Select the content you want to annotate, and then press CTRL +/

Add a line comment, move the mouse to any location of the row, press CTRL +/, cancel and add as inverse action

3) Ctrl + G, then enter the line number, enter the line. For example, jump to line fifth. or CTRL + P, and then enter the line number

4) Press CTRL + R or CTRL + P to execute @. Then fill in the name of the function you want to search

5) Hide Menu bar: View-To hide menu

When the menu bar is hidden and the ALT key is displayed, the menu bar appears. When it is released, the menu bar disappears. To permanently display it, hold down the ALT key-->view--> show Menu

More techniques and methods (ST2 and ST3 methods are similar ) refer to the following URLs:

Http://www.cnblogs.com/xiaowu/archive/2012/08/27/2658534.html

Http://www.iplaysoft.com/sublimetext.html

http://blog.csdn.net/zm2714/article/details/7989384

Sublime Text 2 Setup file

This is the Python editor sublime text is complete!

Selenium2+python Study notes (ii) Python editor Sublime

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.