I doubt that you can only do this with the readline module, since it will not capture individual keystrokes, but simply processes character responses from your input driver.
You can do this with PyHook , although if you press the Shift along with the Enter key to enter a new-line into the readline stream.
Christian witts
source share