[Python] [basics] [] [use built-in functions of print]

Original English help files:

print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False)

Print objects to the text stream file, separated by sep and followed by end. sep, end, file and flush, 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 objects are 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. Since printed arguments are converted to text strings, print() cannot be used with binary mode file objects. For these, use file.write(...) instead.

Whether output is buffered is usually determined by file, but if the flush keyword argument is true, the stream is forcibly flushed.

Changed in version 3.3: Added the flush keyword argument.

 

-------- (I am dividing line) --------

Chinese explanation:

print(*objectssep=' 'end='\n'file=sys.stdoutflush=False)

Print object file to a text stream, separated by sep, heel end. sep, end, file and flush (if present) must be given as keyword arguments.


All non-key parameters are converted to str () such as a string, and written to the stream, separated by sep, heel end. sep and end must be strings; they can also be none, which means that the default value. If the object is not given, print () will only write end.
parameter must be an object file having a write (string) method; if not present or not, sys.stdout will be used. Since the printing parameters is converted into a text string, print () can not be used in the binary mode file object. For these, use file.write (...).
Whether the output buffer is usually determined by the file, but if flush keyword argument is true, then force a refresh stream.
Changes in version 3.3: Added flush keyword arguments.

 

 

-------- (I am dividing line) --------

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

python print output delay, output immediately allowed

A print ( "ni hao"), for a long time can not see, how can let the python print output immediately it.

Because the python default buffer is written to stdout, use the -u parameter to start python, will immediately output.

python3 are driver.py

 

 

 

 

 


-------- (I am dividing line) --------

reference:

1. Python 3.7.2 documentation

2. RUNOOB.COM:

https://www.runoob.com/python/python-func-print.html

https://www.runoob.com/w3cnote/python3-print-func-b.html

3. 

 

Remarks:

Initial modified: September 22, 2019 17:04:59

Environment: Windows 7 / Python 3.7.2

 

Guess you like

Origin www.cnblogs.com/kaixin2018/p/11580227.html
Recommended