基于Python把网站域名解析成ip地址
作者:十一的杂文录 时间:2021-08-23 05:31:06
起因
因为一些事情,需要将域名解析为ip地址,想到Python作为万能语言,就用Python来实现这个功能
代码
import socket
url = 'shiyixirui.cn'
res = socket.getaddrinfo(url, None)
print(res)
ip = res[0][4][0]
print(ip)
结果
来源:https://www.cnblogs.com/shiyixirui/p/12886693.html
标签:Python,域名,解析,ip
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
启动targetcli时遇到错误解决办法
2023-03-20 05:59:43
php抓取页面的几种方法详解
2023-11-14 10:53:42
引起用户注意的界面方式
2007-10-07 21:17:00
![](https://img.aspxhome.com/file/UploadPic/200710/7/2007107212329681s.jpg)
使用python实现链表操作
2021-07-29 23:30:38
![](https://img.aspxhome.com/file/2023/4/80604_0s.png)
详解Python中使用base64模块来处理base64编码的方法
2022-01-12 01:27:19
Linux下安装Python3和django并配置mysql作为django默认服务器方法
2023-11-15 01:04:44
Tensorflow实现卷积神经网络的详细代码
2022-02-20 22:14:06
Linux环境MySQL服务器级优化讲解
2008-12-04 17:21:00
使用Python编写类UNIX系统的命令行工具的教程
2023-08-24 05:03:02
用python写个颜值评分器筛选最美主播
2022-11-25 22:13:08
![](https://img.aspxhome.com/file/2023/1/80731_0s.png)
用javascript获得地址参数的两种方法
2008-04-30 12:17:00
简单的Python的curses库使用教程
2023-11-06 15:04:28
![](https://img.aspxhome.com/file/2023/9/78699_0s.gif)
JS中模拟函数重载
2008-01-03 16:46:00
Servlet实现文件上传,可多文件上传示例
2023-08-25 02:31:29
![](https://img.aspxhome.com/file/2023/3/56243_0s.jpg)
Python标准库之sqlite3使用实例
2023-08-12 18:44:05
![](https://img.aspxhome.com/file/2023/2/81562_0s.png)
Oracle与SQL Server在企业应用的比较
2010-07-20 13:34:00
基于jQuery实现的立体文字渐变效果
2009-05-18 19:15:00
![](https://img.aspxhome.com/file/UploadPic/20095/18/pic-22s.jpg)
详解Python的文件处理
2022-07-16 23:46:15
![](https://img.aspxhome.com/file/2023/4/85004_0s.png)
Python爬取科目四考试题库的方法实现
2023-02-14 00:29:39
![](https://img.aspxhome.com/file/2023/0/70220_0s.jpg)
sql如何在Access中选择指定日期前的记录?
2010-06-17 12:47:00