匹配×××号码:
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)
匹配电话号码
str = '''
15210885691
aas45541563
11223434556
11223569987
uud123asfdg
1598364894316
'''
# str = '15210885691 aas45541563 11223434556 11223569987 uud123asfdg 1598364894316'
# result = re.findall(r'\d{11}',str)
# print(str)
result = re.findall(r'^1[3-9]\d{9}$',str,re.M)
for i in result:
print(i)