Python - 判断正则表达式是否匹配上

1 IPRegex = re.compile(r'\d+.\d+.\d+.\d+:\d{1,5}')
2 ip = IPRegex.search(proxyip[td].getText())
3 if ip:
4     print('1')
5 else:
6     print('2')
7     continue

 

posted @ 2020-07-18 21:06  shmcn  阅读(3883)  评论(0)    收藏  举报