import serial,time ser=serial.Serial('COM3',19200,timeout=1) ser.write("ls\r") time.sleep(2) print ser.read(100) ser.close()