I want to sort short list like:
# we can have only 3 types of value: any string numeric value like '555', 'not found' and '' (can have any variation with these options)
row = ['not found', '', '555']
to
# numeric values first, 'not found' less prioritize and '' in the end
['555', 'not found', '']
I trying use
row.sort(key=lambda x: str(x).isnumeric() and not bool(x))
but it's not working
How can I sort it? (numeric values first, 'not found' less prioritize and '' in the end)
sortsupports, yet you somehow expectsortto do what you want. You need to define your own key function to produce the priorities as you define them. Alternately, filter the list into the three groupings you specify, sort each grouping, and concatenate the results.