【发布时间】:2019-05-31 15:37:44
【问题描述】:
为什么第二个代码的输出不只打印 12?
import re
print(re.split('\d+','On 12th feb 2016, at 11:02 A.M',1))
from re import split
print(split('\d+','On 12th feb 2016, at 11:02 A.M'))
['On ', 'th Jan ', ', at ', ':', ' AM']
['On ', 'th Jan 2016, at 11:02 AM']
【问题讨论】:
-
他们是 both
re.split。为什么您期望将另一个参数传递给re.split不会改变输出?
标签: regex python-3.x split