#!/usr/bin/python import telnetlib HOST = "localhost" tn = telnetlib.Telnet(HOST, "999") tn.write("Hello World\n") print tn.read_all()