0

80 文字を超える各行をテキストラップし、長い段落を 80 文字のチャンクに分割する必要があります。各行と段落の最後に \n があります。

This is the first line of text with more than eighty characters in this sentence.**\n**  
**\n**  
This line of text is less than eighty characters.**\n**  
**\n**  
This is the first sentence of the first paragraph. This is the second sentence of the first paragraph. This is the third sentence of the first paragraph. This is the fourth sentence of the first paragraph. This is the fifth sentence of the first paragraph.**\n**  
**\n**  
This is the first sentence of the second paragraph. This is the second sentence of the second paragraph. This is the third sentence of the second paragraph. This is the fourth sentence of the second paragraph.**\n**    

次のような出力が必要です。

This is the very first line of text with more than eighty characters in this **\n**  
sentence.**\n**  
**\n**  
This line of text is less than eighty characters.**\n**  
**\n**  
This is the first sentence of the first paragraph. This is the second sentence **\n**  
of the first paragraph. This is the third sentence of the first paragraph. This **\n**  
is the fourth sentence of the first paragraph. This is the fifth sentence of the **\n**  
first paragraph.**\n**  
**\n**  
This is the first sentence of the second paragraph. This is the second sentence **\n**  
of the second paragraph. This is the third sentence of the second paragraph. This **\n**  
is the fourth sentence of the second paragraph.**\n**  
4

1 に答える 1

5
>>> import textwrap
>>> help(textwrap)
于 2012-08-02T06:32:13.933 に答える