all
当模块中有__all__变量,同时使用from X import *导入模块时,只能导入这个list中的元素携带的方法
all
__all__ = ['testA']
def testA():
print('this is testA')
def testB():
print('this is testB')
from my_module2 import *
testA()
this is testA
2023-11-19 22:01:09
当模块中有__all__变量,同时使用from X import *导入模块时,只能导入这个list中的元素携带的方法
__all__ = ['testA']
def testA():
print('this is testA')
def testB():
print('this is testB')
from my_module2 import *
testA()
this is testA
下一篇:python的异常和包