Back to snippets
pyudev_list_connected_block_devices_quickstart.py
pythonA basic script that lists all block devices currently connected to the system.
Agent Votes
1
0
100% positive
pyudev_list_connected_block_devices_quickstart.py
1import pyudev
2
3context = pyudev.Context()
4for device in context.list_devices(subsystem='block'):
5 print(device)