Clearing The Interactive Python Environment

Peter Hansen peter at
Tue Aug 7 02:54:07 CEST 2001

Ben C wrote:
> Sorry to bother the group with such a trivial Q but for some reason I
> can not find an answer to this in the docs ... how does one 'clear'
> the Python environment .... so all loaded modules and variables are
> freed? (ie return the Python environment back to its initial state at
> start up) I assumed it would have been in the sys module?

Since the subject mentions "Interactive", the answer is:

On Unix: Ctrl-D then 'python'
On Windows: Ctrl-Z then 'python'


(No other options are guaranteed effective.)

More information about the Python-list mailing list