问题
Is there a keyboard shortcut to clear a line for the Python IDLE shell? I know Ctrl-K works if you are at the beginning of a line, but is there a shortcut to do it when you are at the end?
回答1:
If you set idle's Key Set
to IDLE Classic Unix
(Options -> Configure -> Use a Built-in Key Set -> IDLE Classic Unix
) you'll at least be able to get the same effect with C-a C-k
. There doesn't seem to be anything that resembles C-u
in Emacs, for example.
You could look into EditorWindow.py and configHandler.py if you're willing to add the functionality yourself (though it seems that C-k
is a default binding in tk's editor widget).
来源:https://stackoverflow.com/questions/13096329/clear-line-in-the-python-idle-shell