Control - Z In Python Code -
in idle, there's no clear screen, , after reading forums best method plainly print ton of "\n"s. however, after playing idle, made discovery. when game waiting input after printing out instructions using print statements, instead of inputting useful character, entered 'control-z,' , idle began remove text display print statements, 1 one.
my main question is, how manually in code enter 'control-z', can utilize functionality?
if you're confused story, here's example code , try hitting control-z.
print("some text") print("more text") input("the input (hit control - z here):")
^z bit of mess. ascii control char ^d interpreted eot, end of transmission, on unix , many other systems means end of file, close application. ascii ^z meant interpreted sub, substitute, whatever means. editors ofter use undo (meaning undo ^x cut). microsoft (and few other old systems) @ least interprets ^z end of file, same effect ^d on *nix.
the windows console closes text app after ^z . ^d passes on app. idle, cross-platform app, closes on ^d. idle used close on ^z on windows, now, me, erases prompt. (i don't know if alternative intended.) not see progressive deletion report. os , python version running?
to answer main question: can't. input
used in assignment statements: string = input('prompt')
. way imitate input statements directly assign 'user input': s = 'simulated user input'
. however, not work characters intercepted programs managing input window , never sent python program.
idle's shell imitates python's interactive console. latter (at least on windows) makes everything, except current input, read-only. shell follows suite. imitation strict regards executing user code. intended user code tested in idle should run in python without idle. wrong idle clear interactive shell in response user code when python cannot.
for editor , output windows, ^a (select all) followed backspace (delete), delete, or ^x (cut) clear window.
shell does, however, has more editing commands many (most? all?) consoles , menu system. these additions allowed since interactive , not accessible user code. there have been various proposals , patches enable clearing part or of shell window. https://bugs.python.org/issue6143 has of discussions , proposals.
Comments
Post a Comment