tags:

views:

58

answers:

2

When I do a raw_input() and enter values, I am not able to use my arrow-keys to change stuff... is there any way for doing that?

Thanx readline module helps in line editing features. How to use the readline module? Just importing the readline module works!

+1  A: 

That's not how raw_input() works. It reads a line from the prompt, and then processes it after the newline character.

The docs are pretty clear: http://docs.python.org/library/functions.html#raw%5Finput

If you try to throw arrow keys into the mix, your terminal is likely to add those characters to the returned string. Then again, it may not, depending on your operating system. Don't count on it.

Perhaps you want the readline module?

http://docs.python.org/library/readline.html#module-readline

Paul McMillan
how do use the readline module?
Sriram
Read the _Fine_ documentation I linked in my answer?
Paul McMillan
A: 

What do you mean, you are note able to change the "stuff"? Do you mean that you can't move your cursor back and forward with the keys or that you're not able to get the last inputs with the up and down keys?

I've tried on my Windows Computer at work and I could move the cursor.

TiPoK