【发布时间】:2015-11-04 09:22:49
【问题描述】:
首先,我在 bash 中运行 nslookup -q=TXT _netblocks.google.com 8.8.8.8,得到如下结果:
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
_netblocks.google.com text = "v=spf1 ip4:64.18.0.0/20 ip4:64.233.160.0/19 ip4:66.102.0.0/20 ip4:66.249.80.0/20 ip4:72.14.192.0/18 ip4:74.125.0.0/16 ip4:108.177.8.0/21 ip4:173.194.0.0/16 ip4:207.126.144.0/20 ip4:209.85.128.0/17 ip4:216.58.192.0/19 ip4:216.239.32.0/19 ~all"
Authoritative answers can be found from:
现在,我的任务是在 python 中获得相同的结果,并且不能使用 os lib 运行 bash 命令。
我可以使用哪个库?以及如何使用?
【问题讨论】:
-
stackoverflow.com/questions/1189253/… 解释了如何在本机 Python 中执行此操作(尽管使用 SRV 而不是 TXT)。
-
@tripleee 谢谢。这解决了我的问题。但为什么我被否决了......
-
我不是反对者,但如果这是重复的,请标记它。
标签: python