Python 从响应中提取Ip与端口号

import re
def getIp(s):
    return "".join(re.findall(r"\d+\.\d+\.\d+\.\d+\:\d+",s))

if __name__ == '__main__':
s = "is this 10.180.25.174:8080 ip and port 124343"
print("http://" + getIp(s))

打印结果是:
http://10.180.25.174:8080


posted @ 2021-09-15 16:45  yappleorange  阅读(704)  评论(0编辑  收藏  举报