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