【发布时间】:2016-07-22 01:33:24
【问题描述】:
在 python 中,可以使用readline 模块为raw_input 启用标签自动补全:
readline.parse_and_bind("tab: complete")
但是,我怎样才能恢复上面那行的效果呢?
我有一个程序需要在自动完成和\t 之间切换raw_input。
【问题讨论】:
在 python 中,可以使用readline 模块为raw_input 启用标签自动补全:
readline.parse_and_bind("tab: complete")
但是,我怎样才能恢复上面那行的效果呢?
我有一个程序需要在自动完成和\t 之间切换raw_input。
【问题讨论】:
我想出了一个解决方法:
readline.set_completer(lambda text, state: text + "\t" if state == 0 else None)
但是如果tab: complete可以恢复会更好
【讨论】: