import serial as s ser=s.Serial() ser.baudrate = 9600 ser.port = "COM4" ser.timeout=10 ser.open() x=ser.readline() print(x) ser.close()