Newbie: raw_input and other input methods
cfelling at iae.nl
Fri Nov 26 00:09:32 CET 1999
Hassan Aurag <aurag at geocities.com> wrote:
> Anyway, I used raw_input to be able to use readline and its nifty back
> arrow, up arrow...
> However when I wanted to have a nifty prompt like the following one:
> raw_input("\033[0;34mInput: \033[0m"), I was surprised it got all
> screwed up.
bash copes with this, so I dived into the source. And low and behold
there it is: bash uses the readline special codes RL_PROMPT_START_IGNORE
(='\001') and RL_PROMPT_END_IGNORE (='\002') to tell readline to 'ignore'
the chars in between. Using this info you can get what you want:)
works like a charm, atleast here on my linux box
More information about the Python-list