# -*- coding: utf-8 -*- from serial import Serial # type: ignore with Serial("/dev/ttyUSB0", baudrate=9600, timeout=2) as x: x.write(b"Hello, World!") print(x.read(13)) print(x.read(13))