Why does importing a python module not import nested modules?
问题 If I do this: import lxml in python, lxml.html is not imported. For instance, I cannot call the lxml.html.parse() function. Why is this so? 回答1: Importing a module or package in Python is a conceptually simple operation: Find the .py file corresponding to the import. This involves the Python path and some other machinery, but will result in a specific .py file being found. For every directory level in the import ( import foo.bar.baz has two levels), find the corresponding __init__.py file,