推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
jiangbin
V2EX  ›  Python

python 中关于 telnetlib 模块的疑问

  •  
  •   jiangbin · Sep 30, 2015 · 3873 views
    This topic created in 4022 days ago, the information mentioned may be changed or developed.
    最近在写一个脚本,实现利用 telnetlib 模块 telnet 方式远程登录主机( centos ),然后执行命令,获取返回结果,刚开始都正常,直到遇到一条命令,有点长,超过 80 个字符,然后就出现问题,命令发送也正常执行了,但是在返回结果的时候(我直接将结果存文件),发现命令被截断换行了,
    在网上一通查询,找到一个满足我需求的网址,但是讲到的解决方法,没看明白,所以在这里请各位大牛,帮忙解释分析一下,感激不尽!
    网址:
    http://stackoverflow.com/questions/11575558/is-it-possible-to-send-resize-pty-command-with-telnetlib
    3 replies  •  2015-09-30 18:56:46 +08:00
    jiangbin
        1
    jiangbin  
    OP
       Sep 30, 2015
    我明白他修改了 telnetlib.py 文件,但是没弄清楚修改哪里的
    adrianzhang
        2
    adrianzhang  
       Sep 30, 2015
    把这个函数改成原答案里的样子,其中 t 是调用 telnet 命令,所以需要加一个 import.
    adrianzhang
        3
    adrianzhang  
       Sep 30, 2015
    set_option_negotiation_callback
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2342 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 11:45 · PVG 19:45 · LAX 04:45 · JFK 07:45
    ♥ Do have faith in what you're doing.