Lavanya Lavanya - 3 months ago 10
Python Question

how do you see the entire command history in interactive python?

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?

Answer

Use readline.get_current_history_length() to get the length, and readline.get_history_item() to view each.

Comments