Python判断字符串是否为手机号
生活随笔
收集整理的這篇文章主要介紹了
Python判断字符串是否为手机号
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
def judge_phone(tel):"""該函數(shù)判斷一個(gè)字符串是否為手機(jī)號(hào):param tel::return:"""tel = str(tel)ret = re.match(r"^1[35789]\d{9}$", tel)if ret:return Trueelse:return False
def judge_phone(tel):
“”"
該函數(shù)判斷一個(gè)字符串是否為手機(jī)號(hào)
:param tel:
:return:
“”"
tel = str(tel)
ret = re.match(r"^1[35789]\d{9}$", tel)
if ret:
return True
else:
return False
總結(jié)
以上是生活随笔為你收集整理的Python判断字符串是否为手机号的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 上海初中计算机课程大纲,《上海市普通中小
- 下一篇: python编程单片机_Python与C