raw_input不会在readline中保留历史记录 [英] raw_input without leaving a history in readline

查看:75
本文介绍了raw_input不会在readline中保留历史记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以使用raw_input而不在读取行历史记录中留下任何符号,从而在制表符完成时不显示该符号?

Is there a way of using raw_input without leaving a sign in the readline history, so that it don't show when tab-completing?

推荐答案

您可以使函数类似

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,具体取决于您从何处调用它.

and call that function instead of raw_input. You may not need the minus 1 dependent on where you call it from.

这篇关于raw_input不会在readline中保留历史记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆