diff options
Diffstat (limited to 'Doc/library/_winreg.rst')
-rw-r--r-- | Doc/library/_winreg.rst | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Doc/library/_winreg.rst b/Doc/library/_winreg.rst index a3fe72b..7ce34b4 100644 --- a/Doc/library/_winreg.rst +++ b/Doc/library/_winreg.rst @@ -131,6 +131,16 @@ This module offers the following functions: +-------+--------------------------------------------+ +.. function:: ExpandEnvironmentStrings(unicode) + + Expands environment strings %NAME% in unicode string like const:`REG_EXPAND_SZ`:: + + >>> ExpandEnvironmentStrings(u"%windir%") + u"C:\\Windows" + + .. versionadded:: 2.6 + + .. function:: FlushKey(key) Writes all the attributes of a key to the registry. @@ -416,3 +426,16 @@ handle, and also disconnect the Windows handle from the handle object. handle is not closed. You would call this function when you need the underlying Win32 handle to exist beyond the lifetime of the handle object. +.. method:: PyHKEY.__enter__() + PyHKEY.__exit__(\*exc_info) + + The HKEY object implements :meth:`__enter__` and :meth:`__exit__` and thus + supports the context protocol for the :keyword:`with` statement:: + + with OpenKey(HKEY_LOCAL_MACHINE, "foo") as key: + # ... work with key ... + + will automatically close *key* when control leaves the :keyword:`with` block. + + .. versionadded:: 2.6 + |