您的位置首页百科知识

python 匹配正则

python 匹配正则

import ref= open('proxy.txt')pattern = '(.+):(\d?)SOCKS5\$1'src = f.readlines:l = []for i in src: if re.match(pattern, i): m = re.match(pattern, i) s1 = m.group(1) s2 = m.group(2) l.append((s1, s2))然行吵芹后随机碰告在l里选一组就档毕行了