Python常用正则操作

判断字符串是否匹配

import re
def is_matched(string):
    return True if re.match(r'your regex',string) else False

如果匹配, re.match()会返回一个match对象

<_sre.SRE_Match object; span=(0, 0), match=''>

否则返回None

待续...

posted @ 2018-06-28 15:30  Joseph_Chuh  阅读(131)  评论(0编辑  收藏  举报