This article mainly introduces the Pycharm editor skills of the automatic import module, and now share to everyone, but also to make a reference. Come and see it together.
We often inadvertently use some of the classes and modules that have not yet been imported in the programming process, in which case the pycharm will help us locate the module file and add it to the import list, which is known as the Auto-import module feature. This article introduces to you about the Pycharm editor skills of the auto-import module of the relevant information, the need for friends can refer to.
Objective
Pycharm can easily manage the Python interpreter (if multiple words are installed), as well as third-party modules, packages. Pycharm is the preferred IDE for many Python developers, and if a tool can be used skillfully, it often has a multiplier effect, a variety of shortcut keys, refactoring, and debugging techniques. Since Python is a dynamic language, it's easy to have a static language for auto-importing package modules, but we have pycharm and can be very powerful.
Usually write code, to refer to the system comes with the module or a third-party module, or even the other parts of the project, sometimes the code quickly write a full screen, in order to import a module, we have to put the cursor to the top of the file, the module package name manually imported into, and then back to the bottom of the file happily write code, So repeatedly switching back and forth, good trouble. One of the principles of development is that Don ' t repeat yourself, and repetitive labor should be done automatically.
In fact, we only need a simple two-step configuration to let Pycharm automatically import modules
First step: Pycharm->perferences->editor->auto Import
Step Two: Pycharm->perferences->keymap
As simple as this, after the setup is complete, experience the effect. Import the random module, CTRL + SPACE (SPACEBAR press twice) will automatically pop up the optional module list, move up and down to switch.