[Tutor] Writing to the terminal?

Hugo Arts hugo.yoshi at gmail.com
Sun Dec 12 16:21:23 CET 2010


On Sun, Dec 12, 2010 at 2:16 PM, Wayne Werner <waynejwerner at gmail.com> wrote:
>>
>> Try that in the interactive interpreter, it doesn't work.
>> >>> print "a" + chr(13)
>> a
>> (Python 2.6.6)
>
> Actually, it does:
>  >>> print 'a' + chr(13) + 'b'
> b
> The cursor moves back, you just didn't bother to overwrite the 'a'.
> HTH,
> Wayne
>

Am I being spam-filtered or something? This e-mail I sent over two
days ago, cc'd to tutor and also you specifically. Not that you're
wrong, it just seems rather redundant at this point:

On Fri, Dec 10, 2010 at 9:38 PM, Corey Richardson <kb1pkl at aim.com> wrote:
>
> Try that in the interactive interpreter, it doesn't work.
>>>> print "a" + chr(13)
> a

You forgot to print something after the carriage return. It works for me:

Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print 'a'+chr(13)+'b'
b
>>>

the carriage return resets the cursor to the beginning of the line, so
you can write over what you wrote before.

Hugo


More information about the Tutor mailing list