Python: 从不同的模块导入父母和子公司
我在一个文件中有一个父类,另一个文件在另一个子类中,我试图在第三个中使用它们。 类似的东西:
test1.py
test2.py
test3.py
跑步 test3.py 给我以下内容:
我是否需要在同一个地方保留我的父母和子公司?
</module>
test1.py
class Parent/object/:
def spam/self/:
print "something"
test2.py
class Child/Parent/:
def eggs/self/:
print "something else"
test3.py
from test1 import *
from test2 import *
test = Child//
跑步 test3.py 给我以下内容:
File "[path]\test2.py", line 1, in <module>
class Child/Parent/:
NameError: name 'Parent' is not defined
我是否需要在同一个地方保留我的父母和子公司?
</module>
没有找到相关结果
已邀请:
1 个回复
董宝中
赞同来自:
在