Δημοσιεύτηκε: 30 Μαρ 2012, 19:27
από sokoban4ever
Γιατί γεμίζει το output buffer του stream sys.stdout στην python3 στην συνάρτηση print (η παράμετρος για έξοδο είναι η file και έχει Defaut arguement το sys.stdout
έγραψε: Print object(s) to the stream file, separated by sep and followed by end. sep, end and file, if present, must be given as keyword arguments.

All non-keyword arguments are converted to strings like str() does and written to the stream, separated by sep and followed by end. Both sep and end must be strings; they can also be None, which means to use the default values. If no object is given, print() will just write end.

The file argument must be an object with a write(string) method; if it is not present or None, sys.stdout will be used. Output buffering is determined by file. Use file.flush() to ensure, for instance, immediate appearance on a screen.


http://docs.python.org/py3k/library/fun ... rint#print

Κώδικας: Επιλογή όλων
>>> for i in range(10):
... print (i , end = ' ')
... sys.stdout.flush()
... time.sleep(0.2)