脚本以处理来自TXT文件的IP地址列表,然后确认它们是否可访问或在XLSX文件中响应IP

发布于 2025-02-03 18:10:06 字数 537 浏览 3 评论 0 原文

我希望能够从 txt 文件中处理IP地址列表,然后确认它们是否可访问或响应Excel文件中的IP地址。

我已经看到了以下内容,我用作基础,但似乎并没有像我期望的那样起作用。

我要去某个地方;

import re 
import csv 
f = open('C:/Users/dir/dir/iplogs.txt', 'r') #Text file with many ip address 
o = f.read() 
ip1 = re.findall( r"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}", o ) 
hosts = ip1 
for host in hosts: 

但是,那我就无法完全弄清楚如何从这里进行管理。

I would like to be able to python script to process a list of IP addresses from a txt file and then confirm whether they are accessible or responding IP Addresses within a excel file.

I have seen the following, which I have used as a base but it doesn't seem to work or work as I would expect;

https://www.geeksforgeeks.org/extract-ip-address-from-file-using-python/

I was going somewhere along the lines of;

import re 
import csv 
f = open('C:/Users/dir/dir/iplogs.txt', 'r') #Text file with many ip address 
o = f.read() 
ip1 = re.findall( r"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}", o ) 
hosts = ip1 
for host in hosts: 

However then I couldn't quite figure out how to manage this from here.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文