python common problem FAQ summary
original Python In the program , Is to put the original program code in .py In the document , and Python Will be in execution .py When you file . take .py Form of the program compiled into intermediate files (byte-compiled) Of .pyc file , The purpose of this is to speed up the next file execution .
therefore , Before we run python When you file , It will automatically check whether there is .pyc file , If any , and .py Date of revision and .pyc The modification time is the same , It will read .pyc file , otherwise ,Python I'll read the original .py file .
In fact, not all .py Files will be generated during and operation .pyc file , Only in import Corresponding .py When you file , Will generate the corresponding .pyc file
The function of this file is equivalent to managing its entire folder as a package , Whenever there is an external import When , Will automatically execute the functions inside .
windows Under the system :
C:\Users\Administrator Next new :pip Folder pip.ini file
Content
[global]
index-url=https://pypi.tuna.tsinghua.edu.cn/simple
python Use in pydoc Generate project help documents .
Python Standard library
Python Standard module multiprocessing Concurrent multiprocesses
from multiprocessing import Pool
import time
def ssh (ip):
print ("login in %s "%ip)
print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))
time.sleep(10)
if __name__ == '__main__':
with Pool(50) as p:
p.map(ssh,["192.168.1."+ str(i) for i in range(100)])
Python Medium generator (generator)、Iterator( iterator ) and Iterable( Iteration objects ) The difference between
It may be the most complete in the whole network Python operation Excel Library summary !
Horse brother Linux Operation and maintenance - After watching 100 piece Python Technical essence article , Average salary increase 30%!
python Medium encode() and decode() function
Python A complete collection of commonly used modules ( Arrangement )
python journal logging modular ( Detailed analysis )
Tens of thousands of lines of code 22 individual Python Universal formula , Recommended collection !
python call cmd The method of command
Python Standard library ( Very classic introduction of various modules )
Python Detailed knowledge system summary (2021 edition )
pycharm Activate