标签:last nts png for 函数 ace append class known
def print(self, *args, sep=‘ ‘, end=‘\n‘, file=None): # known special case of print """ print(value, ..., sep=‘ ‘, end=‘\n‘, file=sys.stdout, flush=False) Prints the values to a stream, or to sys.stdout by default. Optional keyword arguments: file: a file-like object (stream); defaults to the current sys.stdout. sep: string inserted between values, default a space. end: string appended after the last value, default a newline. flush: whether to forcibly flush the stream. """ pass
如上所示:
python3 中print函数意义为将value值打印到一个数据流中,默认为系统标准输出(sys.stdout)
with open(‘a.txt‘, ‘w‘) as f: print(‘OK‘, file=f)
将‘OK’写入文件
标签:last nts png for 函数 ace append class known
原文地址:https://www.cnblogs.com/gexbooks/p/14835401.html