Python中用正则匹配手机号码

import re

mobile = '18312423454'

MOBILE = "^1[358]\d{9}$|^147\d{8}$|^179\d{8}$"
p = re.compile(MOBILE)

if p.match(mobile):
print(mobile)
posted @ 2019-11-27 20:31  乔儿  阅读(4912)  评论(0编辑  收藏  举报