Python tutorials (Python learning route): PyCharm to share with everyone a few tips today to help you improve efficiency!
# 0. PyCharm common shortcuts
# 1. Check to use the library source code
PyCharm master programmer answered on Stackoverflow
Often hear people say, look at the source code. Source not only help us figure out the operating mechanism, but also learning good library or best-practice framework.
When you call the library, you can click Command + B in almost any place you're curious, you can easily jump to the definition in the source code of classes, methods, functions, variables.
# 2. Let your code PEP8
When writing Python code, you will strictly abide by the norms pep8 it? Or to comply with, otherwise the code spread knowledge on github or almost hate being on the bad. But if you rely on the naked eye to check and pay attention to it, too tired to do it by PyCharm like, Command + Option + L, a key pep8 go together.
# 3 novice no longer worry about installation library
If you are a novice, might bother to install the library, you can use the familiar graphical interface to install the library in PyCharm inside, you do not stuck in a pile in the command line.
# 4. Find files, classes, methods
When we need to find a file name in the project when the input Command + Shift + O, and then enter the file name you want to find it. If you do not remember the full name, just type the first letter, Pycharm will prompt you. For example, I want to find a file called test_errors.py, then only need to enter the tee can be found. Or you only need to enter a query test_errors_1.py tee1 you can find.
5. Quick Select block #
Your comment will be how quickly some Python code block? Is not it line by line ...... plus #
The need to select a function of time, just put the cursor on the front, and then click Command + Option + Shift + [, can be selected for the current block, using the Command + / comment.
6. quickly insert common code #
Sometimes the need to enter a long code, such as if __name__ == __main__:, this time manually entered as a direct Command + J, can be directly inserted into a common code.
# 7. Run / debug code
Run the code, debugging code that most people should be the most commonly used shortcuts bar.
Mac:
Control + r: the current code run directly
Control + d: In the Debug (debug) mode Code
Windows/Linux:
Shift + F10: run directly current code
Shift + F9: to Debug (debug) mode of running code
# 8. indent your code blocks
When writing the front page, often want to change the indentation of a large section of the code, this time you can start with Shift + arrow keys to select a block of code you want to indent, then you can use Tab to indent it.
# 9. Expand / contract Code
When the project is written to a certain size, it is inevitable method / function will be a lot, this time we can use Command + Shift + - symbols to shrink the code, this is mainly for the convenience of viewing.
# 10 display multiple pages
When your company do not want to configure two displays for you, you can still use PyCharm view multiple files in one screen. Mouse over navigation at the current file name, and then right-Split Vertically or Split Horizontally can be friends.
These tips are not you often have to use it? The partners do not know, with you such a detailed summary of the rational use of, ah! More Python Python tutorials and learning path, we will continue to update!