creating an artificial "last element" in sort list
Demian Brecht
demianbrecht at gmail.com
Fri Sep 28 20:32:17 EDT 2012
Apparently gmail hates me and my last response didn't get through:
a = ['awefawef', 'awefawfsf', 'awefsdf', 'zzzzzzzzzzzzzz',
'zzzzzzzzzzzzzz', 'zzzzzzzzzzzzzz']
f = filter(lambda s: s == a[-1], a)
l = sorted(lst[:-len(f)]) + f
Now, not 100% sure about efficiency over large sizes of a, but that's a
naive stab at it anyway.
--
Demian Brecht
@demianbrecht
http://demianbrecht.github.com
More information about the Python-list
mailing list