【发布时间】:2011-08-21 00:28:54
【问题描述】:
有没有办法在 Python 中存储命令?
例如,要存储我可以输入的 bash 命令:
# in .bash_profile
alias myproject="cd /path/to/my/project"
$ project
有没有办法存储命令,例如这样的:
'store' profile="from userprofile.models import Profile"
>>> profile
无论何时/何地打开它都可以在 Python 命令提示符下工作?谢谢。
【问题讨论】:
-
(如果这是您唯一的用例,您可以查看来自django-extensions 的
shell_plus命令)
标签: python django read-eval-print-loop