可能重复:
Python analog of natsort function (sort a list using a “natural order” algorithm)Python的排序问题
我敢肯定,这是简单的,但我无法弄清楚。我有这样的字符串列表(使用后排序):
Season 2, Episode 1: A Flight to Remember
Season 2, Episode 20: Anthology of Interest I
Season 2, Episode 2: Mars University
Season 2, Episode 3: When Aliens Attack
....
Season 3, Episode 10: The Luck of the Fryrish
Season 3, Episode 11: The Cyber House Rules
Season 3, Episode 12: Insane in the Mainframe
Season 3, Episode 1: The Honking
Season 3, Episode 2: War Is the H-Word
我怎样才能让他们正确地分拣? (由赛季便情节#,升序)
你的意思是“按季节*然后*按情节”吧?我不认为第2季和第3季的第1集应该走到一起。 – kennytm 2010-06-13 17:51:18
对,肯尼。编辑澄清。我会看看另一个问题。 – matt 2010-06-13 17:56:55