python之文件调用

test_import_file.py,在当前目录

import sys
sys.path.append("..")

import hello

hello.printHello()

 

 

hello.py,在上一个目录

def printHello():

    print("hello world !")

 

posted on 2017-06-13 14:35  michael_YM  阅读(185)  评论(0编辑  收藏  举报

导航