in thePythonDevelopment (http://www.maiziedu.com/course/python-px/) using the Keyword import to introduce a module, It is similar to the include header file in C + + . For example, to reference the module math, you can use import math to introduce itat the very beginning of the file . when you call a function in the math module, you must refer to this , see the code for details:
>>>improt Math
>>> Math . Sin (0)
To import your own modules:
#hello. Pyprint "Hello world!"
Save the above file under c:/python :
Import SYS
Sys.path. Append (' C:/python ')
>>> Import Hello
Hello world!
Remember to import only once :
>>> Import Hellohello world!
>>> import hello# empty
Modules are used to define functions:
#hello2. Pydef Hello ():
print "Hello, world!"
>>> Import Hello2
>>>hello2.hello ()
Hello, world!.
Here are some miscellaneous:
Package
In order to better organize the modules, they can be grouped, that is, packages.
Import contants Print contants. PI
Help
>>>help (copy. Copy )
Python Learning Notes: the introduction of modules in Python