Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

win10 python com ports

import re

def full_port_name(portname):
    """ Given a port-name (of the form COM7,
        COM12, CNCA0, etc.) returns a full
        name suitable for opening with the
        Serial class.
    """
    m = re.match('^COM(d+)$', portname)
    if m and int(m.group(1)) < 10:
        return portname
    return '\.' + portname
Source by eli.thegreenplace.net #
 
PREVIOUS NEXT
Tagged: #python #ports
ADD COMMENT
Topic
Name
1+7 =