Skip to content

Instantly share code, notes, and snippets.

@th0ma5w
Created December 19, 2010 20:35
Show Gist options
  • Save th0ma5w/747667 to your computer and use it in GitHub Desktop.
Save th0ma5w/747667 to your computer and use it in GitHub Desktop.
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