Python Serial Port Objects under Windows

Python

infostam Pte. Ltd.

Last Update il y a 6 mois

How to list Ports and/or Modem under Windows?

The Python Serial Port Extension for Win32, OSX, Linux, BSD, Jython, IronPython encapsulates the access for the serial port.


The serial.tools.list_ports module can be executed to get a list of ports.


It also contains the comports functions which returns a list of ListPortInfo objects.


However, comports will return both Ports and Modem objects/items together in no particular order.


With a small additional code snippet it is possible to filter for Ports or Modem class only.

Which results

The complete unfiltered list is

Note: A Samsung S22 Ultra mobile device was used for this example.

Was this article helpful?

0 out of 0 liked this article