""" 匹配所有能够表示Python整数的字符串集 """ patt = '[-+]?\d+' # "?"代表前面的正则表达式匹配0次或者1次 m = re.match(patt,'98654') if m is not None: print(m.group())
""" 匹配所有能够表示Python整数的字符串集 """ patt = '[-+]?\d+' # "?"代表前面的正则表达式匹配0次或者1次 m = re.match(patt,'98654') if m is not None: print(m.group())