整數如何使用Python來排序列表格式Python的排序陣列內
format=["12 sheet","4 sheet","48 sheet","6 sheet", "busrear", "phonebox","train"]
像這樣
format =["4 sheet", "6 sheet", "12 sheet", "48 sheet", "busrear, "phonebox", "train"]
編輯:如果數組列表的名單,然後怎麼樣我們是這樣做的一個
format=[[1L, u'12 sheet', 0],[2L, u'4 sheet', 0], [3L, u'48 sheet', 0], [4L, u'6 sheet', 0 [5L, u'Busrear', 0], [6L, u'phonebox', 0], [7L, u'train', 0]]
'x [0] .isdigit()'?!? – thefourtheye
@thefourtheye,使用'x [:1]'來防止IndexError。 – falsetru
啊。很好:)謝謝 – thefourtheye