我正在为DNS传输制作一个脚本,但是当我输入信息时,它会给我以下错误。
其次,当我删除r={}
我有以下错误。请帮帮我,因为我正在学习,所以我学习很慢
host: couldn't get address for 'm': not found
e
host: couldn't get address for 'e': not found
g
host: couldn't get address for 'g': not found
a
host: couldn't get address for 'a': not found
c
host: couldn't get address for 'c': not found
o
host: couldn't get address for 'o': not found
r
host: couldn't get address for 'r': not found
p
host: couldn't get address for 'p': not found
o
host: couldn't get address for 'o': not found
#!/usr/bin/python
import subprocess
domain = raw_input("Enter you're domain: ")
host = subprocess.Popen(['host','-t','ns',domain], stdout=subprocess.PIPE).communicate()[0]
result=host
r={}
for i in r:
print i
zt = subprocess.Popen(['host','-l',domain,i], stdout=subprocess.PIPE).communicate()[0]
print zt
============================
Enter you're domain: google.com
Traceback (most recent call last):
File "./dns-zone.py", line 17, in <module>
print zt
NameError: name 'zt' is not defined
for循环中有一个print语句,所以每次它循环时,它都在打印
i
是什么。此外,请确保print zt
在循环外部被正确地标记而且,它看起来
i
只是一个字母,而不是您可能需要的字符串。这个代码有比你展示的更多的东西吗?r = {}
到底充满了什么?您是否需要执行for i in r.keys()
以正确地迭代相关问题 更多 >
编程相关推荐