Tools — pySerial 3.4 documentation
https://pyserial.readthedocs.io/en/latest/tools.htmlserial.tools.list_ports ¶ This module can be executed to get a list of ports ( python -m serial.tools.list_ports ). It also contains the following functions. serial.tools.list_ports.comports(include_links=False) ¶ The function returns a list of ListPortInfo objects. Items are returned in no particular order. It may make sense to sort the items.