0
無論我做什麼,GNU/readline似乎都會對數據進行排序。我的代碼的代碼看起來就像文檔中:Python + GNU/readline綁定:保持排序順序
tags = [tag.lower() for tag in tags]
def completer(text, state):
text = text.lower()
options = [tag for tag in tags if tag.startswith(text)]
try:
return options[state]
except IndexError:
return None
readline.set_completer(completer)
readline.parse_and_bind('tab: menu-complete')
如果我的標籤是['jarre', 'abba', 'beatles']
,我不斷收到['abba', 'beatles', 'jarre']
。我如何強制保留我的訂單?