Python定制化库的导入

/opt/tmp/a.py

def hello():
        print "hello from a"

 /opt/tmp/b.py

import sys
sys.path.append("/opt/tmp/a.py")
from a import hello
hello()

 output:

hello from a

 

posted on 2012-01-10 16:35  bannyle  阅读(185)  评论(0)    收藏  举报

导航