A.py
def read_1(…)
…
C.py
…
假设我们要在C.py中调用A.py中的read_1函数
- 两个脚本在同一个文件夹下
import A
n = A.read_1(...)
#或者
from A import read_1
n = read_1(...)
- 在不同位置
import sys
sys.path.insert(0, '/public/home/file/')
#'/public/home/file/'是A.py存放路径
import A
n = A.read_1(...)