转载 作者:jgw2008
import win32com.client
def CheckDev():
wmi = win32com.client.GetObject ("winmgmts:")
for usb in wmi.InstancesOf ("win32_usbcontrollerdevice"):
if "&MS_COMP_MTP" in usb.Dependent:
print(usb.Dependent)
print("安卓设备已连接")
return True
if __name__ == '__main__':
while True:
if CheckDev():
break