fork download
  1. #list = [ ["1 NWZ", "1 RWZ", "2 NWZ", "2 RWZ", "1E HZ", "1W HZ", "1-2EHZ", 2.0, "2W HZ", etc...]
  2. #^
  3. #["1 NWZ", "1W HZ", "3E FZ", "SNOK", "POK", 4.0, "1-2EHZ", "2E AK", "2W HZ", etc...]
  4. #^
  5. #["1 BW", "1AW AS"K, "3E FZ", "1BWAK", "POK", "TESTK", "1-2EHZ", "2E AK", 1.0, etc...] ]
  6. #^
  7. listed = [ ["1 NWZ", "1 RWZ", "2 NWZ", "2 RWZ", "1E HZ", "1W HZ", "1-2EHZ", 2.0, "2W HZ"],
  8. ["1 NWZ", "1W HZ", "3E FZ", "SNOK", "POK", 3.0, "1-2EHZ", "2E AK", "2W HZ"],
  9. ["1 BW", "1AW AS", "3E FZ", "1BWAK", "POK", "TESTK", "1-2EHZ", "2E AK", 1.0]]
  10.  
  11. def sortOnFloat(sublist):
  12. return [v for v in sublist if isinstance(v, float)]
  13.  
  14. listed.sort(key=sortOnFloat)
  15.  
  16. for sublist in listed:
  17. print sublist
Success #stdin #stdout 0.09s 10848KB
stdin
Standard input is empty
stdout
['1 BW', '1AW AS', '3E FZ', '1BWAK', 'POK', 'TESTK', '1-2EHZ', '2E AK', 1.0]
['1 NWZ', '1 RWZ', '2 NWZ', '2 RWZ', '1E HZ', '1W HZ', '1-2EHZ', 2.0, '2W HZ']
['1 NWZ', '1W HZ', '3E FZ', 'SNOK', 'POK', 3.0, '1-2EHZ', '2E AK', '2W HZ']