EnumKey vs EnumValue

Pykid mfurmaniuk at gmail.com
Tue Jun 7 09:12:35 EDT 2005


Ok, this was not how I understood it to work earlier when I was going
over this.

I do want to eventually see the values under each key, so I guess if I
want to see what is under each key I need to then reopen it and send
that value to EnumValue.  Tried that and ended up with this which seems
to work:

for i in range(25):
    try:
        regEndeca = EnumKey(regpath,i)
        print regEndeca
        regValue = OpenKey(HKEY_LOCAL_MACHINE, key + "\\" + regEndeca)
        for j in range(25):
            try:
                regstr,value,type = EnumValue(regValue,j)
                print "Value Name: ", regstr, " - Value: ",value, " -
Data: ",type
            except EnvironmentError:
                print "There are", j,"values under",regEndeca
                break
        print "That was using EnumValue."
    except EnvironmentError:
        print "There are", i,"keys under",key
        break
print "That was using EnumKey."

Thanks for the help




More information about the Python-list mailing list