setvalue(keysub_keytypevaluesets the value of key key is an open key or hkey_constant sub_key is the name of the subkey with which to associate the value type is an integer type codecurrently limited to reg_sz value is string containing the value data if sub_key does not existit is created key must have been opened with key_set_value access for this function to succeed setvalueex(keyvalue_namereservedtypevaluesets the value field of key key is an open key or an hkey_constant value_name is the name of the value type is an integer type code as described for the enumvalue(function value is string containing the new value when the values of numeric types (for examplereg_dwordare being setvalue is still string containing the raw data this string can be created using the struct module reserved is currently ignored and can be set to anything (the value is not usednotes functions that return windows hkey object return special registry handle object described by the class pyhkey this object can be converted into windows handle value using int(this object can also be used with the context-management protocol to automatically close the underlying handle--for examplewith winreg openkey(winreg hkey_local_machine"spam"as keystatements lib fl ff