import urllib.request
import subprocess
import socket
import re
child=subprocess.Popen("ipconfig", shell=True, stdout = subprocess.PIPE)
out=child.communicate();#保存ipconfig中的所有信息
ipv6_pattern='(([a-f0-9]{1,4}:){7}[a-f0-9]{1,4})'
m=re.findall(ipv6_pattern,str(out));
address=m[1][0]
print(address)
python获取ipv6地址
最新推荐文章于 2024-07-21 03:57:38 发布