我将如何能够采取像一个字符串'aaaaaaaaaaaaaaaaaaaaaaa' ,并将其分成4个长度元组像(aaaa,aaaa,aaaa)
'aaaaaaaaaaaaaaaaaaaaaaa'
aaaa
用途textwrap.wrap:
textwrap.wrap
>>> import textwrap >>> s = 'aaaaaaaaaaaaaaaaaaaaaaa' >>> textwrap.wrap(s, 4) ['aaaa', 'aaaa', 'aaaa', 'aaaa', 'aaaa', 'aaa']