renzhn
2015-11-25 18:20:53 +08:00
写了个正则 [doge]
In [16]: re.match('(1?\d)(1?\d)([5-7])', '10107').groups()
Out[16]: ('10', '10', '7')
In [17]: re.match('(1?\d)(1?\d)([5-7])', '1055').groups()
Out[17]: ('10', '5', '5')
In [18]: re.match('(1?\d)(1?\d)([5-7])', '1076').groups()
Out[18]: ('10', '7', '6')
In [19]: re.match('(1?\d)(1?\d)([5-7])', '996').groups()
Out[19]: ('9', '9', '6')
In [20]: re.match('(1?\d)(1?\d)([5-7])', '11116').groups()
Out[20]: ('11', '11', '6')
In [21]: re.match('(1?\d)(1?\d)([5-7])', '9127').groups()
Out[21]: ('9', '12', '7')