简体   繁体   English

我无法理解 python 的模块

[英]I cannot understand the module of the python

Thankyou for helping me in advance.谢谢你提前帮助我。

What I am curious is this.我很好奇的是这个。

I made the File A, and in there exist module named B, and there is function C.我制作了文件A,其中存在名为B的模块,并且有function C。

Then to use the C, I should type然后使用 C,我应该输入

from A import B从 A 进口 B

BC() Something like this. BC() 像这样的东西。

but when I use the module numpy, there is file named numpy, and there are many files and module in the numpy.但是当我使用模块numpy时,有一个名为numpy的文件,而numpy中有很多文件和模块。

And if I just type如果我只是输入

Import numpy进口numpy

then I can use numpy.array and everything even though I didnt import any module.然后我可以使用 numpy.array 和一切,即使我没有导入任何模块。

I also want If I just import the file A, then I can use the function C.我也想如果我只是导入文件A,那么我可以使用function C。

How is it possible?这怎么可能? Sorry for my poor English..对不起我的英语不好..

You should import it initially as:您最初应该将其导入为:

from A import B.C

That should help那应该有帮助

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

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