What is winreg.DeleteValue in Python?

winreg (Windows Registry API) provides functions to expose the Windows Registry API to Python. We use this module to expose a low-level interface to the registry.

DeleteValue

The method DeleteValue removes a value associated with a registry key.

Syntax

_winreg.DeleteValue(key, value)

Parameters

key: Any open HKEY_* constant or one of the predefined HKEY_* constants can be given as a parameter to the method.

value: The value a user wants to remove.

This method has no return value.

Code

Here is a coding example demonstrating the use of the DeleteValue method to delete a specific name from the registry. It uses self.hkey and any specific value value1 to be removed from directory.

def deleteValueinRegistry(self): 

       _winreg.DeleteValue(self.hkey,"value1")
     

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved