为什么从“从迭代工具导入链”有效,但不能“导入迭代工具链作为链”



为什么以下工作:

from itertools import chain

但以下没有?

import itertools.chain as chain

import foo.bar语法只能用于从包导入模块,而不能用于导入模块中的对象。 from foo import bar可用于从包导入模块或从模块导入对象。

最新更新