2022-03-21

2022-03-21  本文已影响0人  风声细碎

all在python中的使用

文件test.py

__all__= ['test', '']

def test_1():
    print('test_1')

def test_2():
    print('test_2')

class Test(object):
    pass

在其他模块导入test的时候:

from test import * 
# 在此地只能导入__all__里边的内容
上一篇 下一篇

猜你喜欢

热点阅读