【发布时间】:2010-12-04 18:24:28
【问题描述】:
我正在使用 Python 从 Web 服务收集数据。数据本身是一个将呈现给用户的列表。我已经成功打印出来了:
( 1) Example of strings
( 2) Example 4
( 3) Another Example
( 4) Another Example 2
我使用 rjust (2) 作为数字。但是,如果行很长,打印就会像。分断宽度为终端长度(rxvt, gnome-terminal):
( 1) Example of a very very very very long string and
that doesn't look fine
( 2) Example of indented long line that is very very
long, example line
( 3) Another Example
( 4) Another Example of a very very long string and
whatever here is
但我想要的是这样的打印输出:
( 1) Example of a very very very very long string and
that doesn't look fine
( 2) Example of indented long line that is very very
long, example line
( 3) Another Example
( 4) Another Example of a very very long string and
whatever here is
有什么想法如何打印上面的行而不手动分解行吗?
【问题讨论】:
标签: python printing indentation