python stdout函数_print()函数 + open()+ stdout()
1.适用场景:向屏幕打印字符串
(1)print()函数参数
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
其中参数有:
1.values:即代表想打印的字符串. 可以是一个,也可以是多个
2.sep = ' ' : sep 是separate的缩写,意思是分割. 即表示多个values之间使用xx来分割. 如果未指定,则默认为空格
3.end = '\n' :指打印出内容后,以什么结尾. 如果不指定,默认为: \n换行
4. file = sys.stdo
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
