您如何在交互式Python中查看整个命令历史记录? [英] How do you see the entire command history in interactive Python?
本文介绍了您如何在交互式Python中查看整个命令历史记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在Mac OS X上使用默认的python解释器,我以前的命令 Cmd + K (已清除).我可以使用箭头键逐一浏览它们.但是bash shell中是否有--history选项之类的选项,可以显示您到目前为止输入的所有命令?
I'm working on the default python interpreter on Mac OS X, and I Cmd+K (cleared) my earlier commands. I can go through them one by one using the arrow keys. But is there an option like the --history option in bash shell, which shows you all the commands you've entered so far?
推荐答案
使用 readline.get_current_history_length()
来获取长度,然后 readline.get_history_item()
查看每个.
Use readline.get_current_history_length()
to get the length, and readline.get_history_item()
to view each.
这篇关于您如何在交互式Python中查看整个命令历史记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文