需要帮助仅提取IP地址

我正在编写一个python脚本,该脚本读取文件夹中的所有.html文件,在其中搜索ip地址,然后返回ip地址。

当前,如果我的脚本找到一个IP地址,它将返回一堆东西。     打印结果

关于如何获取IP地址的任何建议?

抱歉,如果我的问题和术语含糊或不正确。我对此很陌生。


#!/usr/bin/env python
import glob
import re
import ipaddress

#Get html files in directory and put them in reports variable
reports_list = glob.glob("*.html")

#opens all reports, and reads through them one by one
for current_report in reports_list:
#opens the current report
    with open(current_report) as input:
        #reads current line from input
        for line in input:
            ip_search_result = re.search(r"[0-9]+(?:\.[0-9]+){3}", line)
            if ip_search_result is not None:
#removes the "none" entries
                ip_search_result = re.search(r'[0-9]+(?:\.[0-9]+){3}', line)
                print(ip_search_result)