Go Python:_winreg type name

Source: Internet
Author: User

Python:_winreg type name



Python winreg
For value types: How do I query _winreg.REG_BINARY for ‘REG_BINARY‘ ? I can do it by hand:

import _winregreg_type_str = { _winreg.REG_BINARY: ‘REG_BINARY‘, _winreg.REG_DWORD: ‘REG_DWORD‘, _winreg.REG_DWORD_LITTLE_ENDIAN: ‘REG_DWORD_LITTLE_ENDIAN‘, _winreg.REG_DWORD_BIG_ENDIAN: ‘REG_DWORD_BIG_ENDIAN‘, _winreg.REG_EXPAND_SZ: ‘REG_EXPAND_SZ‘, _winreg.REG_LINK: ‘REG_LINK‘, _winreg.REG_MULTI_SZ: ‘REG_MULTI_SZ‘, _winreg.REG_NONE: ‘REG_NONE‘, _winreg.REG_RESOURCE_LIST: ‘REG_RESOURCE_LIST‘, _winreg.REG_FULL_RESOURCE_DESCRIPTOR: ‘REG_FULL_RESOURCE_DESCRIPTOR‘, _winreg.REG_RESOURCE_REQUIREMENTS_LIST: ‘REG_RESOURCE_REQUIREMENTS_LIST‘, _winreg.REG_SZ: ‘REG_SZ‘,}reg_type_str.get(_winreg.REG_SZ)

Of course there's a better way. What I want to do ... For example, query:

reg_data, reg_type = _winreg.QueryValueEx(key, reg_value)log.debug("Query: %s [%d:%s]" % (reg_data, reg_type, reg_type_str.get(reg_type)))

I think I should be able to do this:

>>> for k, v in _winreg.__dict__:...  if v == _winreg.REG_SZ:...   print kTraceback (most recent call last): File "<pyshell#468>", line 1, in <module> for k, v in _winreg.__dict__:ValueError: too many values to unpack

Of course, this does not work, but even if it will be with the _winreg problem:

>>> for v in _winreg.__dict__.itervalues():... if v == _winreg.REG_SZ:...  print v111111


This address: codego.net/8986958/
--------------------------------------------------------------------------------------------------------------- ----------
1. I have arrived, I need to do, the original question is provided. The only way to solve this problem is if the _winreg developer provides a function
Article title: Python:_winreg type name
This address: codego.net/8986958/

Go Python:_winreg type name

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.