python 调用 telnet
import telnetlib import sys reload(sys) sys.setdefaultencoding('utf-8') conn = telnetlib.Telnet() conn.open('localhost', 20881) cmd = 'com.xxxx.xxxx.service.XxxxService.xxxx({"currency":"CCN6M","endTime":"2021-01-29 23:47:01","startTime":"2021-01-29 00:35:01","type":"ONE_DAY","class":"com.xxxx.xxxx.service.request.xxxx"})' conn.write('invoke {0}\n'.format(cmd).encode()) data = conn.read_until('dubbo>'.encode()).decode().split('\r\n')[0] print(data)