为什么以下工作:
from itertools import chain
但以下没有?
import itertools.chain as chain
import foo.bar
语法只能用于从包导入模块,而不能用于导入模块中的对象。 from foo import bar
可用于从包导入模块或从模块导入对象。