次のように、値とテキストを使用して選択オプションをソートしようとしています。テキストには特殊文字を含めることができ、ソートする必要があります。しかし、いくつかの特殊文字がアルファベットの後に来ていることがわかりました。最初にすべての特殊文字が必要で、次に Alphabets が必要です。
c = [["#test","#test"], ["?test", "?test"], ["test", "test"], ["TEst", "TEst"], ["]test", "]test"]]
>>> c.sort()
[["#test", "#test"], ["?test", "?test"], ["TEst", "TEst"], ["]test", "]test"], ["test", "test"]]
問題は 'TEst' のようです。
別の簡単な例:
cool = ['#new','?new','[new',']new','NEw','&new','cool','ind']
["#new", "?new", "[new", "]new", "NEw", "&new", "cool", "ind"]
cool.sort()
["#new", "&new", "?new", "NEw", "[new", "]new", "cool", "ind"]