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.
我正在尝试对['a', '2%20q']我希望看到的列表进行排序,['2%20q', 'a']但下面的代码会生成['a', '2%20q'](初始列表保持不变)
['a', '2%20q']
['2%20q', 'a']
sorted(['a', '2%20q']) // output: ['a', '2%20q']
sorted(['a','2%20q'], key=lambda x: 0 if x == '2%20q' else 1)