# pip install wmi import wmi def get_camera_name(): camera_names = [] wmi_obj = wmi.WMI() cameras = wmi_obj.Win32_PnPEntity() for camera in cameras: if camera.Name and 'camera' in camera.Name.lower(): camera_names.append(camera.Name) return camera_names camera_names = get_camera_name() for i, camera_name in enumerate(camera_names): print(f"Camera {i+1} Name: {camera_name}")
标签:Name,获取,cameras,索引,wmi,camera,names,摄像头,name From: https://www.cnblogs.com/zwnsyw/p/17796563.html