python 匹配×××号

2021-07-05 08:07

阅读:604

标签:term   image   imp   号码   电话号码   port   http   src   ffffff   

匹配×××号码:
import re

str=‘‘‘
340800197606129559
130803198801278415
211282200011084484
520111199309186411
510802199408154300
445201198512089142
330783197504113541
51010620000427224x
632525197705239157
130706199706171095
130324199601204453
430521200009234811
42030319740623632X
422823199505184482
510726199711077526
513424199207010502
340700199906273089
152629198005231008
‘‘‘

n=0
result = re.findall(r‘\d{17}[Xx\d]‘,str)
for i in result:
    n +=1
    print(i)

技术分享图片

匹配电话号码

import re

str = ‘‘‘
15210885691
aas45541563
11223434556
11223569987
uud123asfdg
1598364894316
‘‘‘
#result = re.findall(r‘\d{11}‘,str)
#print(str)
result = re.findall(r‘1[3-9]\d{8}‘,str)
for i in result:
    print(i)

技术分享图片

python 匹配×××号

标签:term   image   imp   号码   电话号码   port   http   src   ffffff   

原文地址:http://blog.51cto.com/853056088/2171219


评论


亲,登录后才可以留言!