python获取本机外网ip的方法
作者:令狐不聪 时间:2022-06-24 01:57:16
本文实例讲述了python获取本机外网ip的方法。分享给大家供大家参考。具体如下:
python从显示ip地址的网站获取本机外网ip,这段python代码抓取网站上的ip地址信息
import urllib
import re
print "we will try to open this url, in order to get IP Address"
url = "http://checkip.dyndns.org"
print url
request = urllib.urlopen(url).read()
theIP = re.findall(r"\d{1,3}\.\d{1,3}\.\d{1,3}.\d{1,3}",request)
print "your IP Address is: ", theIP
希望本文所述对大家的Python程序设计有所帮助。
标签:python,获取,ip
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
xhtml+css页面制作过程中问题的解决方案
2008-08-05 18:00:00
python encrypt 实现AES加密的实例详解
2023-02-08 18:02:22
Python实现3行代码解简单的一元一次方程
2023-08-29 19:14:50
windows下使用GoLand生成proto文件的方法步骤
2023-08-25 16:04:21
![](https://img.aspxhome.com/file/2023/2/99632_0s.jpg)
Python通过wordcloud库实现将单词生成词云
2022-02-24 20:17:18
![](https://img.aspxhome.com/file/2023/3/83843_0s.png)
OpenCV-Python实现图像梯度与Sobel滤波器
2021-04-07 05:23:20
![](https://img.aspxhome.com/file/2023/5/82535_0s.png)
总结python实现父类调用两种方法的不同
2022-05-27 14:54:48
![](https://img.aspxhome.com/file/2023/1/123801_0s.png)
Python实现的微信好友数据分析功能示例
2023-09-18 06:00:21
![](https://img.aspxhome.com/file/2023/0/101480_0s.png)
常见数据库系统比较 Oracle数据库
2010-07-28 12:44:00
Python通过psd-tools解析PSD文件
2023-05-25 12:08:47
如何设计一个成功的网站
2007-09-07 10:33:00
selenium python浏览器多窗口处理代码示例
2023-11-20 07:09:29
一文带你掌握Python中文词频统计
2022-11-17 21:02:00
![](https://img.aspxhome.com/file/2023/0/66880_0s.png)
Python版名片管理系统
2021-08-28 18:51:22
![](https://img.aspxhome.com/file/2023/7/99557_0s.png)
详解pygame捕获键盘事件的两种方式
2021-02-27 08:51:54
如何在Unix系统环境下安装MySQL数据库
2009-01-04 13:09:00
Django中自定义模型管理器(Manager)及方法
2022-12-01 17:53:05
使用pytorch搭建AlexNet操作(微调预训练模型及手动搭建)
2023-05-04 05:09:51
![](https://img.aspxhome.com/file/2023/9/78509_0s.jpg)
Pandas 缺失数据处理的实现
2023-07-14 05:57:38
实现UTF8转换GB2312国标码的asp代码
2011-02-28 10:53:00