|
|
发表于 2022-3-11 10:09:46
|
显示全部楼层
>>> help(print)
Help on built-in function print in module builtins:
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.
>>>
从 print 的帮助文档可以看出,print 有 4 个关键字参数,
其中 sep 为打印后的间隔符,默认为空格,
end 为打印的结尾,默认为换行符,
所以 print("你好", name, sep=",", end="!") 是让 你好 和 name 之间以 “,” 作为间隔,以 “!” 作为打印的结尾 |
|