Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

winreg
deletekey

What is winreg.DeleteKey in Python?

Sarvech Qadir

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

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.

DeleteKey

We use the method DeleteKey to remove any specified key. The method takes the key and sub_key as parameters. Using this method removes a key and its values. Otherwise, the method raises an OSError exception.

Syntax

winreg.DeleteKey(key, sub_key)

Parameters

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

sub_key: This is the subkey of any given key. It is a string value. This parameter cannot be None.

The method cannot delete keys that have subkeys. In that situation, the subkeys must be removed first before deleting the key.

RELATED TAGS

winreg
deletekey

CONTRIBUTOR

Sarvech Qadir
Copyright ©2022 Educative, Inc. All rights reserved

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring