[Tutor] How to "refresh" the interactive prompt?

Richard D. Moores rdmoores at gmail.com
Sun Oct 2 07:17:08 CEST 2011


Python 3.2.2, Win 7

When using the Python 3 interactive prompt, is there a way to quickly
"refresh" the prompt? By "refresh" I mean get a new interactive prompt
with nothing imported and all things like  a = "qwerty",   n = 123,
etc. no longer in effect. Not sure what the wording should be for
that. "imports cancelled and variables deleted"?

I know I can do that by entering a Ctrl+z, followed by entering
"python". But could print() be used to do the same thing? I can get a
beep with print("\a"), or clear the screen with   import os;
print(os.system("CLS"),chr(13)," ",chr(13)), but how to print a ^Z?

Dick Moores


More information about the Tutor mailing list