0

If I have a list like this:

lst = ["None", "123", "XYZ", "None", "ABC", "None", "QWE" "None"]

how can I put it so that None is displayed only at end and items that are not None are displayed in order like this:

lst_sorted = ["123", "XYZ", "ABC", "QWE", "None" "None", "None", "None"]

Thanks in advance.

user21398
  • 419
  • 6
  • 13
  • 1
    `lst.sort(key=lambda x: x == 'None')` – vaultah Apr 27 '17 at 21:04
  • Thanks! Knew it would be duplicate, but wasn't able to find anything cause I didnt know how to phrase it correctly and also didnt show when typing in question bar. – user21398 Apr 27 '17 at 21:26

0 Answers0