我怎么能拿一个像’aaaaaaaaaaaaaaaaaaaaaa’的字符串
并将它分成4个长度元组,如(aaaa,aaaa,aaaa)
解决方法:
>>> import textwrap
>>> s = 'aaaaaaaaaaaaaaaaaaaaaaa'
>>> textwrap.wrap(s, 4)
['aaaa', 'aaaa', 'aaaa', 'aaaa', 'aaaa', 'aaa']
2023-07-27 08:44:16
我怎么能拿一个像’aaaaaaaaaaaaaaaaaaaaaa’的字符串
并将它分成4个长度元组,如(aaaa,aaaa,aaaa)
解决方法:
>>> import textwrap
>>> s = 'aaaaaaaaaaaaaaaaaaaaaaa'
>>> textwrap.wrap(s, 4)
['aaaa', 'aaaa', 'aaaa', 'aaaa', 'aaaa', 'aaa']