modular : A code set that implements a function with code , Function modularization , Save time , Increase of efficiency
One 、 Module import
The import module , In fact, it is to tell python Interpreter to interpret the corresponding .py file
• Import .py file , The interpreter explains that .py file
• Pour in a bag , The interpreter explains under the package __init__.py file
Import module method :
import time
from time import sleep
from time import sleep as sp
from time import *
Path to import module , namely sys.path
import sys
print(sys.path) # give the result as follows
['C:\\Users\\Lenovo\\PycharmProjects\\Ethan\\study_day7', 'C:\\Users\\Lenovo\\PycharmProjects\\Ethan', 'C:\\Python35\\python35.zip', 'C:\\Python35\\DLLs', 'C:\\Python35\\lib', 'C:\\Python35', 'C:\\Python35\\lib\\site-packages']
If you don't have the path you want , Use sys.path.append(' route ') To add
Can pass os Modules get various directories , Such as :
import sys
import os pre_path = os.path.abspath('./')
# print(pre_path)
sys.path.append(pre_path)
Two 、 Module classification
Custom module : Personal writing , Call in your own code
Built-in module :python Official supply
Open source module : Third Party writing , Open source download, install and use
How to download and install :
yum
pip
apt-get
Download the source code
Decompress the source code
Entry directory
Compile source code python setup.py build
Installation source python setup.py install
Method 2
python More articles on module introduction
- Python Module introduction and installation [numpy,pandas,matplotlib,scipy,statsmodels,Gensim,sklearn,keras]
https://pan.baidu.com/s/1bpVv3Ef 67bd Module installation file download address pip install "numpy-1.12.0b+mkl-cp35- ...
- Python::OS modular -- brief introduction
OS Module introduction OS The module is Python A module in the standard library for accessing operating system functions ,OS Modules provide a portable way to use the functions of the operating system . Use OS The interface provided in the module , Can achieve cross platform access . But in OS The interface in the module and ...
- python paramiko Module introduction
One : brief introduction paramiko Yes, it is python A module of language writing , follow SSH2 agreement , Support encryption and authentication , Connect to the remote server . Because of the use of python Such a language that can run across platforms , So all python the ...
- Python Of six Module introduction
Python Of six Module introduction six : Six is a Python 2 and 3 compatibility library Six There is no trusteeship in Github On , It's hosted in Bitbucket ...
- Regular expressions :Python modular re brief introduction
In order to make the article more readable , In this paper, regular expressions will be lengthy Grammar introduction At the end of the article . One . Introduction to regular expressions Regular expressions (RegExp) It's a text pattern , Include normal characters ( for example ,a To z Between the letters ) And special characters ( Metacharacters ...
- Python logging Module introduction
Table of Contents 1. Logging modular 1.1. brief introduction 1.2. Simple output log 1.3. Input log to file 1.4. Some basic concepts 1.4.1. loggers 1.4.2. h ...
- python paramiko Module introduction and installation
One : brief introduction paramiko Yes, it is python A module of language writing , follow SSH2 agreement , Support encryption and authentication , Connect to the remote server . Because of the use of python Such a language that can run across platforms , So all python the ...
- 6. Document ownership and permissions ---- Anonymity for free ----Windows Keyboard recorder ---- Introduction and python modular
Document ownership and permissions touch --help cd Desktop mkdir Folder cd Folder clear touch Test1 Test2 Test3 Test4 ls ls -l ...
- python From introduction to the great God ---Python Of jieba Module introduction
python From introduction to the great God ---Python Of jieba Module introduction One . summary One sentence summary : jieba Bag is word segmentation technology , That is to divide a sentence into many words , There are many word segmentation models to choose from 1. Which word segmentation modes does the word segmentation module package have ( such as py ...
Random recommendation
- Appcan——Box
Box framework ub….. Box Architecture element space size allocation ratio ub-f……. Ub-f1,ub-f2,ub-f3……. Box The vertical arrangement of architecture elements ub-ac,ub-ae… -webkit-box-a ...
- jQuery Static methods noConflict Use and source code analysis
The so-called static method is jQuery It has to be a public method , You don't need to instantiate to call , It is also called tool method , Let's start with a list of jQuery.noConflict Method usage : noConflict() Method assignment variables $ Of j ...
- PHP in curl Of CURLOPT_POSTFIELDS Parameter usage details
CURL It's really a good tool , Not only in PHP In other operating systems , They are all very useful . But if you don't use some parameters well , You may not get what you want . In general , We use CURL To submit PO ...
- gdb Debugging program
To debug the generated executable , It must be added at the time of generation -g Options , Generate code that can be debugged for example :gcc -o test a.c b.c -g such gcc Some debugging symbols will be added when linking When generating executable runs that can be debugged ...
- solve At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this log
pom increase :<dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</art ...
- Android Project practice ( Nine ):CustomShapeImageView Custom shape's ImageView
A third-party class library that came out two years ago , Having not limited to circles ImageView It's in many shapes ImageView, Project development must github Download address :https://github.com/MostafaGazar/Custo ...
- POJ 1062 Expensive betrothal gifts shortest path difficulty :0
http://poj.org/problem?id=1062 #include <iostream> #include <cstring> #include <queue ...
- LeetCode Binary Tree Level Order Traversal ( Gather elements by layer )
The question : By layer , Gather elements in a two-dimensional array . Ideas : Extensive search should be a common method . It can also avoid stack overflow , How easy to use . collocation deque, Because you have to delete it often . /** * Definition for a binary tree ...
- 【Django】 rest-framework and RestfulAPI The design of the
[rest-framework] This is a base django Components that work , Designed to construct API Of . Speaking of API, I have done some small projects before API, But those are all ticket playing , The structure is very simple and the required design ...
- List<T>.ForEach An unexpected call to an asynchronous method
There's an asynchronous way private static async Task<int> Compute(int s) { return await Task<int>.Run(() = ...