2013-02-27 74 views
0

我以純文本形式發送電子郵件。現在我有一個帶有文本的字符串,我將其插入到電子郵件中。但是,我希望此文本具有最大字符寬度。Python - 在文本中插入換行符,以便文本不會超過最大字符寬度

所以輸入文本例如:

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. 

當然,我們必須考慮到,你不能在中間分裂一個字。當你有'和 - '這樣的symol時,它會變得非常棘手,所以我想知道是否有工具可以爲你做這件事?我聽說NLTK,但我還沒有找到解決方案,也許這有點矯枉過正?

回答

相關問題