wingetports.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:driveboardapp 作者: nortd 项目源码 文件源码
def portiter():
    key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, b'HARDWARE\\DEVICEMAP\\SERIALCOMM') # open the registry
    i = 0
    while True: # loop until we run out of devices
        try:
            name = bytes(winreg.EnumValue(key, i)[1]) # get the device name
            # EnumValue gets item number i, returning a tuple containing the name in position 1
        except OSError: # that's all the devices
            break
        yield name, port_prefix + name
        i += 1
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号