我在 html 中有 IP:PORT 列表,当我使用 findall 搜索所有 ip 时,我得到所有 ip 的列表,因为 IP 是唯一的,一些端口是相同的,我通过示例列表获得 100 个 IP 和只有 87 个端口。如何找到所有重复的端口?
proxies = re.findall("[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}",html)
ports = re.findall("[0-9]{1,3}\,[0-9]{1,3}\,[0-9]{1,3}\,[0-9]{1,3}",html)
#ports are coded to looks like this 47,46,47,46
print len(proxies)
print len(ports)