# helloworld.py
def helloworld():
print('hello world')
$ testhelloworld.py
import helloworld
helloworld.helloworld()
import sys, pprint #pprint提供更加智能的打印输出
pprint.pprint(sys.path) # Documents/Github/ThinkinginPython/venv/lib/python3.6/site-packages
import drawing #引drawing包,这时只有__init__模块中的内容是可用的,shapes & colors不可用
import drawing.colors # colors模块可用,但是必须通过全名drawing.colors使用
from drawing import shapes # shapes模块可用,并且可以通过短名shapes进行调用
模块