Python typing for module type
问题 I am dynamically loading a Python module using importlib.import_module as follows def load_module(mod_name: str) -> ???: return importlib.import_module(mod_name) Can somebody tell me what is the correct type annotation for a module type. The typing module does not contain one and I could not find an answer elsewhere. 回答1: You're looking for types.ModuleType. 来源: https://stackoverflow.com/questions/48389157/python-typing-for-module-type