开发者

raw_input without leaving a history in readline

开发者 https://www.devze.com 2023-02-20 23:13 出处:网络
Is there a way of using raw_input without leaving a sign in开发者_JAVA技巧 the readline history, so that it don\'t show when tab-completing?You could make a function something like

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


You could make a function something like

import readline

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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号