4
Python標準庫隨模塊textwrap
提供,它提供了簡單的文本包裝功能。 java標準庫中有什麼可比的東西嗎?Java標準庫中是否有文本包裝功能?
在Python它是這樣的:
>>> t = "a really really long string with lots of characters"
>>> import textwrap
>>> textwrap.wrap(t, 20)
['a really really long', 'string with lots of', 'characters']
您可以加入的一個例子在Python中的功能? – danb 2008-10-13 15:14:30