Re: [Tutor] console output that is same in Python 2 and 3

2010-09-28 Thread Tim Golden
On 27/09/2010 17:11, Thierry Tung wrote: Hello tutor at python.org. How can I write strings to the console in a way that will give the same result in Python 3 and Python 2? I tried sys.stdout.write('hello') on Microsoft vista. with python 3.1.2 sys.stdout.write('hello') hello5 with py

[Tutor] console output that is same in Python 2 and 3

2010-09-28 Thread Thierry Tung
Hello tutor at python.org. How can I write strings to the console in a way that will give the same result in Python 3 and Python 2? I tried sys.stdout.write('hello') on Microsoft vista. with python 3.1.2 >>>sys.stdout.write('hello') hello5 >>> with python 2.7 >>>sys.stdout.write('hello') hel

Re: [Tutor] Console output

2005-10-06 Thread Alan Gauld
> Hmm, just have to say something about the old days when > 'carriage return' and 'line feed' really meant something :-) Yep, and on a teleype were two physically separate keys! Alan G ___ Tutor maillist - Tutor@python.org http://mail.python.org/mail

Re: [Tutor] Console output

2005-10-05 Thread Kent Johnson
Oliver Maunder wrote: > Just what I needed - thanks everyone. I never realised '\r' was actually > good for something other than Windows line breaks! Hmm, just have to say something about the old days when 'carriage return' and 'line feed' really meant something :-) Kent __

Re: [Tutor] Console output

2005-10-05 Thread Marcin Komorowski
- Original Message - From: "Roel Schroeven" <[EMAIL PROTECTED]> To: Sent: Wednesday, October 05, 2005 2:53 PM Subject: Re: [Tutor] Console output > Oliver Maunder wrote: >> Does anyone know how I can update a line of console output without >> creatin

Re: [Tutor] Console output

2005-10-05 Thread Alan Gauld
> 14% [===> ] 344,192 16.28K/s ETA 02:19 > > All the figures and the progress bar get continously updated. The only way > I > know of sending output to the console is to use print or > sys.stdout.write(), > but that would give me: > 14% [===> ] 344,192 16.28K/s ETA 02:19 > 18% [=>

Re: [Tutor] Console output

2005-10-05 Thread Oliver Maunder
Just what I needed - thanks everyone. I never realised '\r' was actually good for something other than Windows line breaks! Olly ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Console output

2005-10-05 Thread Johan Geldenhuys
This might help. Never used it though. Johan Christian Wyglendowski wrote: > -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Oliver Maunder Sent: Wednesday, October 05, 2005 1:13 PM To: tutor@python.org Subject: [Tutor] Console output D

Re: [Tutor] Console output

2005-10-05 Thread python-tutor
>>> import sys >>> import time >>> myList=range(10) >>> for x in myList: ... sys.stdout.write(str(x) + "\r") ... sys.stdout.flush() ... time.sleep(1) The "\r" causes a return without a newline feed. Flush forces the text to be output (instead of getting buffered) Enjoy! Todd Maynard

Re: [Tutor] Console output

2005-10-05 Thread Roel Schroeven
Oliver Maunder wrote: > Does anyone know how I can update a line of console output without > creating a new line? I'm not explaning this too well, so here's an example. > > When you download a file with wget, the console display looks like this: > > 14% [===>

Re: [Tutor] Console output

2005-10-05 Thread Christian Wyglendowski
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Oliver Maunder > Sent: Wednesday, October 05, 2005 1:13 PM > To: tutor@python.org > Subject: [Tutor] Console output > > Does anyone know how I can update a line of console ou

[Tutor] Console output

2005-10-05 Thread Oliver Maunder
Does anyone know how I can update a line of console output without creating a new line? I'm not explaning this too well, so here's an example. When you download a file with wget, the console display looks like this: 14% [===>    ] 344,192