Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有一种方法可以使用 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,具体取决于您从哪里调用它。