gwg gwg - 1 year ago 126
Python Question

How can I clear the Python pdb screen?

Let's say I write

(Pdb) p dir(object)

and, now my screen is taken up with a list of attributes. How can I clear this text while still in debug mode? Importantly, I don't want to lose my place in the code.

Answer Source

Depends on your OS. If you're on windows this should work:

import os; os.system('cls')

If you're on GNU/Linux (I think in Mac OS too) this should do the trick:

import os; os.system('clear')

But, if you use bash as you shell interpreter, there is a handy keymap: CTRL+l

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download