test_import_file.py,在当前目录
import sys sys.path.append("..") import hello hello.printHello()
hello.py,在上一个目录
def printHello(): print("hello world !")
时间: 2025-02-01 21:51:37
test_import_file.py,在当前目录
import sys sys.path.append("..") import hello hello.printHello()
hello.py,在上一个目录
def printHello(): print("hello world !")