有没有一种方法可以在不在readline历史记录中留下符号的情况下使用raw_input,以便在Tab完成时不显示?

有帮助吗?

解决方案

您可以创建类似

的功能
import readline

def raw_input_no_history():
    input = raw_input()
    readline.remove_history_item(readline.get_current_history_length()-1)
    return input

并调用该函数而不是raw_input。您可能不需要减1取决于您从哪里调用它。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top