我正在以纯文本格式发送电子邮件。现在我有一个包含文本的字符串,我将其插入到电子邮件中。但是,我希望此文本具有最大字符宽度。
所以输入文本例如:
This is the input text. It's very boring to read because it's only an example which is used to explain my problem better. I hope you can help me.
我希望它变成:
This is the input text. It's very
boring to read because it's only
an example which is used to explain
my problem better. I hope you can
help me.
当然我们需要考虑到你不能在一个单词中间分裂。当你有像 ' 和 - 这样的符号时,它可能会变得非常棘手,所以我想知道是否有工具可以为你做到这一点?我听说过NLTK,但我还没有找到解决方案,也许它有点矫枉过正?