[英]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.