print()
mattia
gervaz at gmail.com
Sat Oct 17 06:30:32 EDT 2009
Il Fri, 16 Oct 2009 22:40:34 -0700, Dennis Lee Bieber ha scritto:
> On Fri, 16 Oct 2009 23:39:38 -0400, Dave Angel <davea at ieee.org>
> declaimed the following in gmane.comp.python.general:
>
>
>> You're presumably testing this in the interpreter, which prints extra
>> stuff. In particular, it prints the result value of any expressions
>> entered at the interpreter prompt. So if you type
>>
>> sys.stdout.write("hello")
>>
>> then after the write() method is done, the return value of the method
>> (5) will get printed by the interpreter.
>>
> I was about to respond that way myself, but before doing so I
wanted
> to produce an example in the interpreter window... But no effect?
>
> C:\Documents and Settings\Dennis Lee Bieber>python ActivePython 2.5.2.2
> (ActiveState Software Inc.) based on Python 2.5.2 (r252:60911, Mar 27
> 2008, 17:57:18) [MSC v.1310 32 bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import sys
>>>> sys.stdout.write("hello")
> hello>>>
>
>
> PythonWin 2.5.2 (r252:60911, Mar 27 2008, 17:57:18) [MSC v.1310 32 bit
> (Intel)] on win32.
> Portions Copyright 1994-2006 Mark Hammond - see 'Help/About PythonWin'
> for further copyright information.
>>>> import sys
>>>> sys.stdout.write("This is a test")
> This is a test
>>>>
>>>> print sys.stdout.write("Hello")
> HelloNone
>>>>
>>>>
>
> No count shows up... neither PythonWin or Windows command line/
shell
Indeed I'm using py3. But now everythong is fine. Everything I just
wanted to know was just to run this simple script (I've also sent the msg
'putchar(8)' to the newsgroup):
import time
import sys
val = ("|", "/", "-", "\\", "|", "/", "-", "\\")
for i in range(100+1):
print("=", end="")
# print("| ", end="")
print(val[i%len(val)], " ", sep="", end="")
print(i, "%", sep="", end="")
sys.stdout.flush()
time.sleep(0.1)
if i > 9:
print("\x08"*5, " "*5, "\x08"*5, sep="", end="")
else:
print("\x08"*4, " "*4, "\x08"*4, sep="", end="")
print(" 100%\nDownload complete!")
More information about the Python-list
mailing list