我有一个很长的字符串:
S='Hello\n i have a very very very very..... very very very very.... long Text!'
打印这段文本会生成一行很长的文字,我希望将其分成每行最多包含10或20个字符的小块。我希望使用\n
来分割行,并将\n
包含在新字符串中。
我的期望是:
Hello
i have a very
very very very
..... very very
very very....
long Text!
textwrap
。 - Peter Wood