【发布时间】:2021-10-25 07:54:51
【问题描述】:
我在 python 解释器中插入了几个命令,并希望在重新进入解释器 shell 后查看整个历史记录。 我该怎么做?
例如:
$ python
Python 3.7.1 (default, Jul 14 2021, 18:08:28)
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> print('hello')
>>> print('world')
>>> exit()
重新输入后插入history 之类的内容并能够看到插入到下面的命令
$ python
Python 3.7.1 (default, Jul 14 2021, 18:08:28)
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> {some_history_like_command}
print('hello')
print('world')
exit()
>>>
【问题讨论】:
-
@Arvind 谢谢。我真的试图搜索同样的问题,但没有找到。
标签: python shell interpreter