Using gnu readline in my own python program?

S

sboyle55

Hi...I'm a newbie to python, and very confused. I'm writing a simple
program and want the user to be able to edit a line that I display
using the full gnu readline capabilitites. (For example, control+a to
go to the beginning of the line.)

Then I want to be able to read the line after it's been edited...

I know that with perl I would do this with some variation on
term::readline.

I've looked at the readline and code packages under Python but I can't
make heads or tails of them. The readline example in the docs is way
over my head.

Any ideas?

Thanks
 
T

Thomas Lotze

sboyle55 said:
Hi...I'm a newbie to python, and very confused. I'm writing a simple
program and want the user to be able to edit a line that I display using
the full gnu readline capabilitites. (For example, control+a to go to the
beginning of the line.)

Then I want to be able to read the line after it's been edited...

Probably the built-in function raw_input already does what you want. It
uses readline if available.
 
S

sboyle55

raw_input is an excellent suggestion, and almost exactly what I want.

But, I want to give the user a string to edit, not have them start from
scratch inputting a string.

Any other ideas?
 

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,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top