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

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

  

原文地址:https://www.cnblogs.com/shenckicc/p/7297900.html