Table of Contents
1 Install py-isort package
Install py-isort with M-x package-list-packages.
py-isort 0.8 available Use isort to sort the imports in a Python buffer
2 Install isort
Install isort with pip.
$ sudo pip install isort
If python-mode is enabled, add py-isort-before-save to before-save-hook.
(add-hook ‘python-mode-hook ‘(lambda() (add-hook ‘before-save-hook ‘py-isort-before-save)))
4 Execution result
The orders of import are time and random before saving.
The orders of import are random and time after saving.