Print objects 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 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. Whether output is buffered is usually determined by file, but if the flush keyword argument is true, the stream is forcibly flushed.
运行
python -h
,我看到一个命令行选项:这是relevant doc。
在Python 3上,^{} 可以采用可选的
flush
参数在Python 2上,您必须执行以下操作
在调用} 打印到^{} (有关file objects的详细信息,请参阅文档)。
print
之后。默认情况下,^{自Python 3.3以来,您可以强制普通的
print()
函数刷新,而无需使用sys.stdout.flush()
;只需将“flush”关键字参数设置为true。来自the documentation:相关问题 更多 >
编程相关推荐