/ Published in: Python

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
>>> s '1/Mar/1215' >>> pattern = r"(\d+)" >>> re.match(pattern, s).groups() ('1',) >>> pattern = r"(\d+)/(Sept|Mar)/(\d+)" >>> re.match(pattern, s).groups() ('1', 'Mar', '1215')
Comments
