获取注册表某键下的所有子键

#!/usr/bin/env python
#coding:utf-8
import _winreg

key = "想要获取的键"
open_key=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, key)
countkey=_winreg.QueryInfoKey(open_key)[0]
keylist=[]
for i in range(int(countkey)):
    name=_winreg.EnumKey(open_key,i) #获取子键名
    keylist.append(name)
_winreg.CloseKey(open_key)
print keylist

 

posted @ 2013-10-22 19:26  @烈风  阅读(598)  评论(0编辑  收藏  举报