sys.stdin.read() replacement

Ben Last ben at benlast.com
Mon Aug 16 07:38:20 EDT 2004


import readline will work on Windows:
a) if you're running the cygwin python, inside cygwin
b) if you've installed a readline module; there are at least two available.
Excuse me for the self-referential answer, but about half and hour before I
read this, I wrote a blog entry all about readline modules, with links to
and comments about the Windows ones.  The permalink is
http://www.livejournal.com/users/benlast/16766.html or it's the most recent
entry at http://www.livejournal.com/users/benlast/

Karin: if you do import a readline, you can then use sys.stdin.readline() to
read a line of input, and you should get some sort of history functionality
(up-arrow, for example, will recall a previous line).

regards
b

> -----Original Message-----
> From: python-list-bounces+ben=benlast.com at python.org
> [mailto:python-list-bounces+ben=benlast.com at python.org]On Behalf Of
> P at draigBrady.com
> Sent: 16 August 2004 11:52
> To: python-list at python.org
> Subject: Re: sys.stdin.read() replacement
>
>
> Karin Lagesen wrote:
> > I am writing a small write-logfile script for use on the
> terminal. I have here
> > a section where the user should be able to type in several
> lines. I have solved
> > it so far by using sys.stdin.read(), which makes it possible to
> type in several
> > lines (separated by enter) and then terminate the session by
> typing ^D. This is
> > all very good. However, with this it is only possible to edit
> the line you are
> > in. If you spot an error further up in your text, you cannot
> get at it. Do any
> > of you know of a way I can do this?
>
>
> import readline
>
> (I don't know if it works on windos)
>
> Pádraig.
> --
> http://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list