location_usb.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:IoT_Car-Final_Project 作者: hanmolee 项目源码 文件源码
def getLocation():
    context = pyudev.Context()
    removable = [device for device in context.list_devices(subsystem='block', DEVTYPE='disk') if device.attributes.asstring('removable') == "1"]
    for device in removable:
        partitions = [device.device_node for device in context.list_devices(subsystem='block', DEVTYPE='partition', parent=device)]
        for p in psutil.disk_partitions():
            if p.device in partitions:
                mntpoint = p.mountpoint
                print(p.device + ' => ' + mntpoint)
                return mntpoint
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号