Skip to content

Instantly share code, notes, and snippets.

@73VW
Last active April 27, 2018 12:30
Show Gist options
  • Save 73VW/5f100c3d0a6870e63427b7dc0bb1a9eb to your computer and use it in GitHub Desktop.
Save 73VW/5f100c3d0a6870e63427b7dc0bb1a9eb to your computer and use it in GitHub Desktop.
import serial
from serial.tools import list_ports
serials = list(list_ports.comports())
attrs = ['device', 'name', 'description', 'hwid', 'vid', 'pid',
'serial_number', 'location', 'manufacturer', 'product', 'interface']
for s in serials:
[print(attr + ": " + str(getattr(s, attr))) for attr in attrs]
print("\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment