本文整理汇总了Python中six.moves.winreg.EnumKey方法的典型用法代码示例。如果您正苦于以下问题:Python winreg.EnumKey方法的具体用法?Python winreg.EnumKey怎么用?Python winreg.EnumKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类six.moves.winreg
的用法示例。
在下文中一共展示了winreg.EnumKey方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_acroversion
# 需要导入模块: from six.moves import winreg [as 别名]
# 或者: from six.moves.winreg import EnumKey [as 别名]
def get_acroversion():
" Return version of Adobe Acrobat executable or None"
from six.moves import winreg
adobesoft = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r'Software\Adobe')
for index in range(winreg.QueryInfoKey(adobesoft)[0]):
key = winreg.EnumKey(adobesoft, index)
if "acrobat" in key.lower():
acrokey = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, 'Software\\Adobe\\%s' % key)
for index in range(winreg.QueryInfoKey(acrokey)[0]):
numver = winreg.EnumKey(acrokey, index)
try:
res = winreg.QueryValue(winreg.HKEY_LOCAL_MACHINE, 'Software\\Adobe\\%s\\%s\\InstallPath' % (key, numver))
return res
except Exception:
pass
return None
示例2: enum_keys
# 需要导入模块: from six.moves import winreg [as 别名]
# 或者: from six.moves.winreg import EnumKey [as 别名]
def enum_keys(key):
at = 0
while True:
try:
yield winreg.EnumKey(key, at)
except OSError:
break
at += 1
示例3: list
# 需要导入模块: from six.moves import winreg [as 别名]
# 或者: from six.moves.winreg import EnumKey [as 别名]
def list():
"""Return a list of all time zones known to the system."""
with winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE) as handle:
with winreg.OpenKey(handle, TZKEYNAME) as tzkey:
result = [winreg.EnumKey(tzkey, i)
for i in range(winreg.QueryInfoKey(tzkey)[0])]
return result
示例4: list
# 需要导入模块: from six.moves import winreg [as 别名]
# 或者: from six.moves.winreg import EnumKey [as 别名]
def list():
"""Return a list of all time zones known to the system."""
handle = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE)
tzkey = winreg.OpenKey(handle, TZKEYNAME)
result = [winreg.EnumKey(tzkey, i)
for i in range(winreg.QueryInfoKey(tzkey)[0])]
tzkey.Close()
handle.Close()
return result
示例5: find_available_vc_vers
# 需要导入模块: from six.moves import winreg [as 别名]
# 或者: from six.moves.winreg import EnumKey [as 别名]
def find_available_vc_vers(self):
"""
Find all available Microsoft Visual C++ versions.
"""
vckeys = (self.ri.vc, self.ri.vc_for_python)
vc_vers = []
for hkey in self.ri.HKEYS:
for key in vckeys:
try:
bkey = winreg.OpenKey(hkey, key, 0, winreg.KEY_READ)
except (OSError, IOError):
continue
subkeys, values, _ = winreg.QueryInfoKey(bkey)
for i in range(values):
try:
ver = float(winreg.EnumValue(bkey, i)[0])
if ver not in vc_vers:
vc_vers.append(ver)
except ValueError:
pass
for i in range(subkeys):
try:
ver = float(winreg.EnumKey(bkey, i))
if ver not in vc_vers:
vc_vers.append(ver)
except ValueError:
pass
return sorted(vc_vers)
示例6: find_available_vc_vers
# 需要导入模块: from six.moves import winreg [as 别名]
# 或者: from six.moves.winreg import EnumKey [as 别名]
def find_available_vc_vers(self):
"""
Find all available Microsoft Visual C++ versions.
"""
ms = self.ri.microsoft
vckeys = (self.ri.vc, self.ri.vc_for_python, self.ri.vs)
vc_vers = []
for hkey in self.ri.HKEYS:
for key in vckeys:
try:
bkey = winreg.OpenKey(hkey, ms(key), 0, winreg.KEY_READ)
except (OSError, IOError):
continue
subkeys, values, _ = winreg.QueryInfoKey(bkey)
for i in range(values):
try:
ver = float(winreg.EnumValue(bkey, i)[0])
if ver not in vc_vers:
vc_vers.append(ver)
except ValueError:
pass
for i in range(subkeys):
try:
ver = float(winreg.EnumKey(bkey, i))
if ver not in vc_vers:
vc_vers.append(ver)
except ValueError:
pass
return sorted(vc_vers)