#!/usr/bin/env python3 import paramiko c=paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect('10.88.0.4',username='eric',password='4669805',timeout=15) cmd=r"""grep -E 'stream copy|ffprobe|probe|transcode|不可用|YouTube Live profile' /home/eric/d2ypp2-src/.pm2/logs/youtube2__ch_mpyvqkc0_gj63k-out.log | tail -25""" _,o,_=c.exec_command(cmd,timeout=30) print(o.read().decode('utf-8','replace').encode('ascii','backslashreplace').decode()) c.close()