|
发表于 2021-4-15 11:20:16
|
显示全部楼层
本楼为最佳答案
查阅帮助文档,IDLE中输入help(print)就可以
- >>> 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.
复制代码
sep=' ' --->表示print()函数中如果有多个参数默认以1个空格间隔
end='\n' --->表示print()函数默认以换行符结尾
所以。。。试试
print(1,2,3) --->打印的是1 2 3加换行,而不是123
print(1,2,3,end='')
print(4,5,6,sep='')
--->打印的是1 2 3456 |
|