爱薇Ivy趣闻

关注

python中的__all__

爱薇Ivy趣闻

关注

阅读 55

2023-05-18


以“from 模块名 import *”形式导入的模块,当该模块有 all 变量时,只能导入该变量指定的成员,未指定的成员是无法导入的。
例如:

#demo.py
def a():
    print("1")
def b():
    print("2")
def c():
    print("3")
__all__ = ["a","b"]

```python
#test.py
from demo import *
a()
b()
c()

python中的__all___python


相关推荐

乱世小白

python中的“__all__ ”作用

乱世小白 108 0 0

捡历史的小木板

python __all__ 放的位置

捡历史的小木板 8 0 0

艾米吖

Python学习---Python的异步IO[all]

艾米吖 124 0 0

李雨喵

abap 中 for all entries in 中的 distinct 功能

李雨喵 10 0 0

沈芏

python之all()、any()

沈芏 179 0 0

水沐由之

MySQL中 any,some,all 的用法

水沐由之 81 0 0

践行数据分析

Python学习---重点模块的学习【all】

践行数据分析 81 0 0

一叶轻舟okok

Python学习---函数的学习1209[all]

一叶轻舟okok 91 0 0

无愠色

Django中object.all

无愠色 165 0 0

q松_松q

python all any函数(相反)

q松_松q 105 0 0

精彩评论(0)

0 0 举报