http://www.cnitblog.com/seeyeah/archive/2009/03/15/55440.html
python包含子目录中的模块方法比较简单,关键是能够在sys.path里面找到通向模块文件的路径。
下面将具体介绍几种常用情况:
(1)主程序与模块程序在同一目录下:
如下面程序结构:
`-- src
|-- mod1.py
`-- test1.py
若在程序test1.py中导入模块mod1, 则直接使用import mod1或from mod1 impo
转载
2016-04-14 18:17:14 ·
1407 阅读 ·
0 评论