gpt4 book ai didi

python - raw_input 不在 readline 中留下历史记录

转载 作者:太空宇宙 更新时间:2023-11-03 12:10:04 25 4
gpt4 key购买 nike

有没有一种方法可以使用 raw_input 而不在 readline 历史记录中留下一个符号,这样它就不会在制表符完成时显示?

最佳答案

你可以做一个像这样的函数

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,具体取决于您从哪里调用它。

关于python - raw_input 不在 readline 中留下历史记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5506728/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com