【问题标题】:undo binding tab to auto-completion撤消绑定选项卡以自动完成
【发布时间】:2016-07-22 01:33:24
【问题描述】:

在 python 中,可以使用readline 模块为raw_input 启用标签自动补全:

readline.parse_and_bind("tab: complete")

但是,我怎样才能恢复上面那行的效果呢?

我有一个程序需要在自动完成和\t 之间切换raw_input

【问题讨论】:

    标签: python readline


    【解决方案1】:

    我想出了一个解决方法:

    readline.set_completer(lambda text, state: text + "\t" if state == 0 else None)
    

    但是如果tab: complete可以恢复会更好

    【讨论】:

      猜你喜欢
      • 2011-08-02
      • 2013-08-29
      • 1970-01-01
      • 2021-12-15
      • 1970-01-01
      • 2019-07-07
      • 2012-06-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多