我有一个 classex.py 文件:
class Class1:
def method1():
print 'stack1'
def method2():
print 'over1'
def method3():
print 'flow1'
class Class2:
def method1():
print 'stack2'
def method2():
print 'over2'
def method3():
print 'flow2'
class Class3:
def method1():
print 'stack3'
def method2():
print 'over3'
def method3():
print 'flow3'
我想要访问classex
文件类,所以我将导入该文件如何在各种类中访问。
例如:
import classex
print Class1.method1()
print Class2.method2()
我的期望输出是stack1
和over2