简体   繁体   English

Python:如何选择可以从包中导入的模块?

[英]Python : How to choose modules that can be import from a package?

I have four packages in my program, among them i would like one and only one, to be accessible from the outside, by a user of my program. 我的程序中有四个软件包,其中我希望一个和唯一的一个软件包可由程序的用户从外部访问。 Brievly, my programm, should be like a black box with only one entry(one of the package). 简而言之,我的程序应该像一个只有一个条目(包中的一个)的黑匣子。

You can't. 你不能 But prefixing the "implementation" modules with a single underscore will act as an indicator that they should not be used directly. 但是,在“实现”模块前面加上单个下划线将指示不应该直接使用它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM