__all__方法的作用

在__all__里面写了谁,到时候就只能用谁,其他的用不了,from 模块 import *时就只能用__all__里的

__all__=['test1','Test']

def test1():
    print('test1')

def test2():
    print('test2')

num=100

class Test(object):
    pass

 

posted @ 2018-12-12 00:02  Operater  阅读(239)  评论(0编辑  收藏  举报