fgz
fgz
@fighting41love 感谢您的赖心解答!!!
@fighting41love  麻烦再请教个问题:抽取地址能不能把这一串都拿出来(河南省郑州市金水区金水路83号院2号楼14号)
抽取手机号码时,把身份证号识别成shoujih手机号了。
>>> print(ex.extract_cellphone(str,nation='CHN')) ['410105196904010537', '13673630861.'] 下面是我用正则表达式匹配的 >>> import re >>> re.search(r'^\d{15}|\d{18}|\d{17}(\d|X|x)',str).group() '410105196904010537' >>> re.search(r'(^(\d{3,4}-)?\d{7,8})$|(13[0-9]{9})',str).group() '13673630861'
you new version also have bug,when it get cell phone numbuer ,there was a a point in the end. (e.g."13673630861.") 