print详解

时间:2019-11-30
本文章向大家介绍print详解,主要包括print详解使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。
 1 """
 2 print(...)
 3     print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False)
 4 
 5     Prints the values to a stream, or to sys.stdout by default.
 6     Optional keyword arguments:
 7     file:  a file-like object (stream); defaults to the current sys.stdout.
 8     sep:   string inserted between values, default a space.
 9     end:   string appended after the last value, default a newline.
10     flush: whether to forcibly flush the stream.
11 
12 """
1 *values : 表示要打印的值 
表示任何多个无名参数, 各个值之间用‘,’(逗号隔开),打印出来各个值之间用空格隔开 
2 sep=' ' : 表示当输入多个打印的值时,各个值之间分割方式, 默认空格,可以自定义,
end=‘\n’**: 控制print中传入值输出完后结束符号,默认换行,这里可以设置为其他,如 ‘\t’, ’ ’ 等等, 可以自己定义
file=sys.stdout:设置输出设备,及把print中的值打印到什么地方,默认输出到准端,可以设置file= 文件储存对象,把内容存到该文件中
flush=False: 该参数主要是刷新, 默认False,不刷新,Ture时刷新,

原文地址:https://www.cnblogs.com/dadaizi/p/11963801.html