Import Module
Import Module Name
Import OS
Os.system ( ' date ')
import os as Win8 module name is too long and can be alias
From Module Name Import Call method
From
OS import system
system (' Date ')
From OS import * * All methods under Call module
Import a custom module
. py file
folder
folder must
There are __init__.py files, otherwise
folder and the following Py module cannot be imported
System Module
Import OSImport Module
Os.system (")Calling module
Os.popen ("). Read () Call module command execution result
Import Commands
commands.getstatusoutput (")
or invoke the execution result with the commands module
Import SYS
SYS.ARGV parameter values, all parameters are taken
Sys.argv[2]
take position of 2 parameters
Custom ModulesCreate a new module moudle.py call module and print a word
Invokes the module and executes
Once executed, a PYC file is automatically generated.
Path , the module under this path can be imported directly using the
Sys
Sys.path
From for notes (Wiz)
3-Using and importing modules