{"id":47,"description":"Python: Get interpreter history","tags":["python","programming"],"contents":["# History of commands run in python interpreter are cached at $HOME/.python_history","# readline module provides the methods to access the entries from the underlying history buffer","# readline.get_current_history_length() returns the current number of items","# readline.get_history_item(index) returns the item at the given index","import readline","history_length = readline.get_current_history_length()","for i in range(1, history_length):","    print(readline.get_history_item(i)"]}
