繁体   English   中英

在 Windows 10 中查找 USB 的循环 python 函数

[英]Looping python function that Looks for USB in Windows 10

好的,所以我正在尝试制作一个 python 脚本,该脚本将查找名为MyUSB的 USB 驱动器,该程序将每 2 秒检查一次。 有没有人有任何我应该使用的建议代码?

项目中,我已经习惯了检查USB检测。

 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")

但它检测所有可移动驱动器。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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