def rdelete(self, key, subkey):
""" Recursively delete a Windows registry key.
This function will remove a key, even if it
has child keys. There is no equivalent in
_winreg. """
if type(key) is str:
hkey = Registry.map_key(key)
elif type(key) is Registry.RegistryKey:
hkey = key.getkey()
else:
hkey = key
if type(subkey) is str:
subkey = self.open(hkey, subkey)
# test2
childkeys = subkey.keys()
for keyname in childkeys:
# print 'Child=>',keyname
childkey = self.open(subkey.getkey(), keyname)
self.rdelete(subkey, childkey)
# print subkey.getkeyname()
wreg.DeleteKey(hkey, subkey.getkeyname())
评论列表
文章目录