判断字符串是否匹配

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

待续...

相关文章:

  • 2021-11-07
  • 2022-12-23
  • 2022-12-23
  • 2021-08-11
  • 2021-05-18
  • 2022-02-07
猜你喜欢
  • 2021-05-23
  • 2022-12-23
  • 2021-07-02
  • 2022-12-23
  • 2022-01-15
  • 2021-04-18
  • 2022-01-25
相关资源
相似解决方案