projec/
|___model/
| |___count.py
| |___new_count.py
|___test.py
count.py
class A():
def add(self,a,b):
return a +b
new_count.py
from count import A
class B (A):
def sub(self,a,b):
return a-b
result =B().add(2,5)
print(result)
test.py
import sys
sys.path .append ("./model") #将model命令添加到系统环境变量下
from model import new_count
test =new_count.B()
test.add(2,4)
输出结果:
=================================
7