Keyboard input

M

Mr.SpOOn

Hi,
I need to get keyboard input in a python program. I need it to let the
user choose some options, for example:

1) option 1
2) option 2
3) option 3

and then to input some data to the program.

I'm using the raw_input method and it works fine, but I noted that I
can't use backspace and when I accidentally press shift space (because
I need to input uppercase letters separated by a space) it writes some
strange characters.

So, is there another way to get keyboard input?

Thanks,
Carlo
 
J

Jonathan Gardner

Hi,
I need to get keyboard input in a python program. I need it to let the
user choose some options, for example:

1) option 1
2) option 2
3) option 3

and then to input some data to the program.

I'm using the raw_input method and it works fine, but I noted that I
can't use backspace and when I accidentally press shift space (because
I need to input uppercase letters separated by a space) it writes some
strange characters.

So, is there another way to get keyboard input?

Maybe curses is overkill, but it will do what you need. Most
interactive console apps use curses. You've run into some of the
problems of simply reading STDIN.
 
N

Nobody

I'm using the raw_input method and it works fine, but I noted that I can't
use backspace and when I accidentally press shift space (because I need to
input uppercase letters separated by a space) it writes some strange
characters.

So, is there another way to get keyboard input?

sys.stdin.readline()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top