我试图弄清楚为什么我在这个脚本中出现错误。第 18 行似乎是问题所在,但对 python 来说是新手,它试图弄清楚它的速度很慢......有什么建议吗?
import sys
from Registry import Registry
reg = Registry.Registry(sys.argv[1])
def rec(key, depth=0):
print "\t" * depth + key.path()
for subkey in key.subkeys():
rec(subkey, depth + 1)
rec(reg.root())
try:
key = reg.open("SOFTWARE\\Microsoft\\Windows\\Current Version\\Run")
except Registry.RegistryKeyNotFoundException:
print "Couldn't find Run key. Exiting..."
sys.exit(-1)
for value in [v for v key.values() \
if v.value_type() == Registry.RegSZ or \
v.value_type() == Registry.RegExpandSZ]:
print "%s: %s" % (value.name(), value.value())
enter code here