更新时间:2023-09-06 13:55:28
>>> s = "This is a very long string with many many many many and many more sentences and there is not one character that i can use to split by, just by number of words"
>>> l = s.split()
>>> n = 5
>>> [' '.join(l[x:x+n]) for x in xrange(0, len(l), n)]
['This is a very long',
'string with many many many',
'many and many more sentences',
'and there is not one',
'character that i can use',
'to split by, just by',
'number of words']