在 Linux 上使用 python 获取 USB 驱动器唯一 ID 的最简单方法是什么?
我想使用 python 从 USB 硬盘获取我正在处理的项目的唯一 ID。实现这一目标的最简单方法是什么?有更好的方法吗?这可以独立于平台完成吗?
I want to get the unique id from an usb hard-drive with python for a project im working on. What is the easiest way of achieving this? Is there a better way to do it? Can this be done platform independent?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用系统调用读入“lsusb”,然后解析输出。
或者更容易解析的解决方案是命令库。
然后您可以使用设备的正则表达式操作或搜索输出。
Use the system call to read in 'lsusb', and then parse the output.
Or an easier to parse solution would be the commands library.
And then you would manipulate or search output with regex for your device.