python

xiaoxiao2021-02-28  112

语法

本质就是一个string list。 example from https://github.com/balancap/SSD-Tensorflow/blob/master/deployment/model_deploy.py#L111

__all__ = ['create_clones', 'deploy', 'optimize_clones', 'DeployedModel', 'DeploymentConfig', 'Clone', ]

作用

定义使用from xxx import *时能从xxx导入的变量。

示例

test_all__.py

__all__ = ['a', 'b'] a = 1 b = 2 c = 3

test_all__2.py

from test_all__ import * print a print b try: print c except: print 'c is not imported' python test_all_2.py

输出:

1 2 c is not imported

References

http://blog.csdn.net/orangleliu/article/details/49848413
转载请注明原文地址: https://www.6miu.com/read-94906.html

最新回复(0)