python 按照固定长度分割字符串

>>> import re
>>> string = '123456789abcdefg'
>>> re.findall(r'.{3}', string)
['123', '456', '789', 'abc', 'def']
>>> 

  

posted @ 2017-08-07 10:31  悟空的爸爸  阅读(10399)  评论(0编辑  收藏  举报