Created
January 30, 2018 02:31
-
-
Save toaco/2585571342646d39e991315d2c762d6b to your computer and use it in GitHub Desktop.
导入某个路径下的所有模块
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import importlib | |
import pkgutil | |
for loader, name, is_pkg in pkgutil.walk_packages(__path__): | |
importlib.import_module('.{}'.format(name), 'models') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment