northisland
V2EX  ›  问与答

我想用 python 做一个能用 tab 键给出下一步提示的脚本,像 make+tab 那样的。可以么?

  •  
  •   northisland · Oct 9, 2016 · 2174 views
    This topic created in 3512 days ago, the information mentioned may be changed or developed.

    我想用 python 做一个能用 tab 键给出下一步提示的脚本,像 make+tab 那样的。

    但我不知道用什么方法。

    又不会把这个想法用英文表达出来,去 google 。

    google (python press tab key to pop up what to do next ?

    俺英语说的不native,提出的问题,谷歌娘也理解不能。)

    求各位提示啦。谢谢

    2 replies    2016-10-10 00:25:29 +08:00
    ldbC5uTBj11yaeh5
        1
    ldbC5uTBj11yaeh5  
       Oct 9, 2016   ❤️ 1
    给你看个 bbfreeze 的代码。 https://github.com/schmir/bbfreeze/blob/master/bbfreeze/py.py#L74 当然这货也是抄别人的。
    注意关键字 rlcompleter 和 readline
    billlee
        2
    billlee  
       Oct 10, 2016   ❤️ 1
    你是要在 python 里面起个 readline 来实现这个功能,还是外部的 shell 调用你的 python 时自动补全?如果是后者你需要的是 shell 脚本。
    http://www.tldp.org/LDP/abs/html/tabexpansion.html
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   936 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 43ms · UTC 20:02 · PVG 04:02 · LAX 13:02 · JFK 16:02
    ♥ Do have faith in what you're doing.