数字

import re

number = "123456789"
result = re.findall("\d{1,2}", number)

print(result) # ['12', '34', '56', '78', '9']

import textwrap
s = ' '.join(textwrap.wrap(text='123456', width=2))
print(s)
 

 

posted @ 2018-11-06 13:49  疯狂的骆驼  阅读(130)  评论(0编辑  收藏  举报