简体   繁体   中英

Looping python function that Looks for USB in Windows 10

Ok, so I'm trying to make a python script that will look for a USB drive called MyUSB , and the program will check for it every 2 seconds. Does anyone have any suggested code I should use?

Project in which i have used to check usb detection .

 import os
 a=os.popen("wmic logicaldisk get description")
 dev_list=a.read()
 if "Removable" in dev_list:
    print("Pendrive Detected")
 else:
    print("Pendrive is not there")

but it detects all removable drive .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM