小编Man*_*yer的帖子

在新行打印时在新行开头添加空格

当我尝试使用 python 3 在多行上打印任何数据时,除了第一行之外,所有行的开头都会添加一个空格。例如:

[in] print('a','\n','b','\n','c')
Run Code Online (Sandbox Code Playgroud)

输出将是:

a
 b
 c
Run Code Online (Sandbox Code Playgroud)

但我想要的输出是:

a
b
c
Run Code Online (Sandbox Code Playgroud)

到目前为止,我只能通过执行三个打印命令来做到这一点。有人有什么想法吗?

printing whitespace python-3.x output

1
推荐指数
1
解决办法
1012
查看次数

标签 统计

output ×1

printing ×1

python-3.x ×1

whitespace ×1