Pythonselection of editing tools
In Python's interactive command line to write programs, the advantage is that you can get results, the disadvantage is unable to save, the next time you want to run, you have to knock again.
So, in the actual development, we always use an editor to write code, finished, save as a file, so that the program can be run repeatedly.
There are now roughly two types of commonly used
1. Editor
Use Vim to write code under Linux:
Use notepad++ for editing under Windows
Using the editor is quick and easy, but if the development code is too large or develop a project, the editor is not so good, then focus on the integrated development attack.
2. Integrated Tools IDE
Pycharm
Pycharm is a python IDE built by JetBrains with a complete set of tools to help users improve their productivity when developing with the Python language, such as debugging, syntax highlighting, project management, code jumps, smart tips, AutoComplete, unit tests, Version control. In addition, the IDE provides advanced features to support professional web development under the Django framework. is currently the best Python development tool.
Other Python tools do not introduce one by one, we can self-Baidu under the HA.
installation and use of Pycharm:
Installation of 1.PyCharm
1. Website Download: http://www.jetbrains.com/pycharm/
Pycharm is divided into Community Edition and Professional Edition, as the name suggests Community Edition does not charge, Professional Edition fee, function more powerful, Community edition relative function is weaker, recommend everybody installs the Professional edition, as for the activation code depends on everybody to think out, haha.
2. Installation
Install the installation of the report in the next step, follow the instructions to install it, there is not much to do description.
Settings for Pycharm
First, create a new Python project
Once installed, the first time you open Pycharm, you first need to create a project
Click Create New Project to enter the interface, where the location of the map is to choose where you installed the Python, select OK, click Create.
Select the save path for the project you want to build in the location
Select the Pythton.exe you have installed in the interpreter
Click Create to complete the new.
In the interface such as the mouse right click on the red place, and then finally select the Python file, in the pop-up box fill in the File name (any fill out)
After the successful creation of the file, you can write your own program by entering the following interface.
Second,pycharm basic Settings
Set background theme font, etc.
File-->settings point Open Interface, select font settings theme scheme set background color, size font, line spacing lines, etc.
Set up a template
File-->settings point Open Interface Select File and Code Templates, save after editing.
Then we create the py file will automatically load these default configuration, is not very convenient.
Annotations:
#!/usr/bin/env python
#-*-Coding:utf-8-*-
# @time: 2017/10/17 23:00
# Author:wangxinpeng
# @File: test.py
The first line indicates that the required parameters are executed under Linux, in order to facilitate the portability of the code.
The second line represents the Chinese character set, python2.7 is not supported by default in Chinese, you need to add Chinese coded character set
The third line indicates when the code was created
Line four indicates the author of the code to make it easier for others to find you faster.
Row Five indicates the file name
Third, run the first Python program
Create a new py file, enter the following code, enter your own name to print. Hello+name.
Right click to run, or shortcut key after completion
You will see the following screen, enter your name and print
Four, pycharm parameter setting
Some scripts need to be brought into the parameters when we run the Py script, so let's set up how to bring in the parameters:
Click the run out interface, edit the Red box section to add parameters
Red box section add required Parameters
Five, pycharm commonly used fast construction
Ctrl +/Line Comment
Tab/shift + Tab indent, not indent forward
Ctrl+x/shift+delete clipping the current line or selected code block to the Clipboard
Ctrl+c/ctrl+insert Copy the current line or selected code block to the Clipboard
Ctrl+v/shift+insert pasting from the Clipboard
Ctrl + Shift + V paste from the nearest buffer
Ctrl + D to copy the selected range or row
Ctrl + Y Deletes the selected line ALT + Shift + F10 run mode configuration
Alt + Shift + F9 Debug mode configuration
Shift + F10 Run
Shift + F9 Debugging
Ctrl + Shift + F10 Run editor configuration
Ctrl + Alt + R run manage.py task
Ctrl + Shift + N Quick Search
F3 Next
Shift + F3 Previous
Ctrl + R Replacement
Ctrl + Shift + F Global Lookup
Ctrl + Shift + R global substitution
Six, pycharm debug mode
In writing code often encountered in some places error, need to debug correction;
Click on the Red Box section to go in debug mode for debugging.
Vii. Configuring Linux environments under Windows Pycharm
Sometimes it takes a Linux debug project to get the code into Linux, but it's time-consuming or inconvenient to debug, this article explains how to configure the Linux environment under Windows Pycharm
Http://www.cnblogs.com/wxp997/p/7684776.html
Day2-python Tool selection and use