passing string for editing in input()

Chris Rebert clp2 at rebertia.com
Sun Feb 7 17:52:38 EST 2010


On Sun, Feb 7, 2010 at 8:24 AM, Aahz <aahz at pythoncraft.com> wrote:
> In article <mailman.1787.1265117353.28905.python-list at python.org>,
> Chris Rebert  <clp2 at rebertia.com> wrote:
>>On Tue, Feb 2, 2010 at 5:24 AM, mk <mrkafk at gmail.com> wrote:
>>>
>>> Is there an easy way to get an editing (readline) in Python that would
>>> contain string for editing and would not just be empty?
>>>
>>> I googled but found nothing.
>>
>>Er...: http://docs.python.org/library/readline.html
>>It's the third hit for "python readline".
>>
>>Actually reading the page, sounds like you want readline.insert_text()
>>specifically.
>
> That seems a tad harsh, especially after reading the docs and following
> Peter Otten's link.  It's not at all obvious how to actually use
> insert_text(), and although I probably could have figured it out on my
> own, I might well have posted here myself.  Did you try using
> insert_text() before posting?

No; I've never used the readline module for that matter. I was just
giving a (hopefully helpful) suggestion based on a quick scan of the
docs (hence the tentative "sounds like"). The OP's comment about
finding /nothing/ on Google made it sound as though they hadn't
located/checked the readline module docs. In retrospect, I might have
misinterpreted in that regard; but in my defense, if they did check
the docs, it might have been good to say so, and if they had found
insert_text(), they ought to have made their question more specific.

Cheers,
Chris



More information about the Python-list mailing list