首先对这个模糊的问题感到抱歉。但我正在尝试理解一个python程序,并遇到一些我以前从未见过的代码。具体来说,在ModuleA.py
中,我们有
def human_size(num, precision = 3):
return human_num(num, precision + 'B')
在ModuleB.py
中,
from .ModuleA import human_size
human_size # what is this line trying to achieve?
代码中还有其他类似的行。
更新:代码库来自https://github.com/houtianze/bypy
模块A→bypy/printer_util.py
模块B→bypy/util.py
从.ModuleA更改为ModuleA,如果模块在其他目录中写入/路径/名称模块