Skip to content

Instantly share code, notes, and snippets.

@th0ma5w

th0ma5w/readBack.py

Created Dec 19, 2010
Embed
What would you like to do?
print the last x lines from your interpreter (default 50)
import readline
def readBack(length=50):
history_items=range(readline.get_current_history_length()+1)
this_readback=history_items[-length:]
for line in this_readback:
print readline.get_history_item(line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment