# https://pyserial.readthedocs.io/en/latest/pyserial_api.html # pip install pyserial import serial if __name__ == "__main__": with serial.Serial('COM10') as serial_port: line = serial_port.readline()