D
Derek Basch
Hello All,
I need to sort a list using an unnatural sequence.
I have a list like so:
foo = ["White/M", "White/L", "White/XL", "White/S", "Black/S", "Black/M"]
print foo.sort()
['White/L', 'White/M', 'White/S', 'White/XL', 'Black/M', 'Black/S']
The order that I actually need is:
["White/S","White/M", "White/L", "White/XL", "Black/S", "Black/M"]
So, in other words, I need the colors sorted alphabetically and the the sizes
sorted logically.
I looked for a while at using comparison functions with sort but I don't think
that will work. Anyone been down this road? Suggestions?
Thanks a million,
Derek
__________________________________
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.
http://promotions.yahoo.com/new_mail
I need to sort a list using an unnatural sequence.
I have a list like so:
foo = ["White/M", "White/L", "White/XL", "White/S", "Black/S", "Black/M"]
print foo.sort()
['White/L', 'White/M', 'White/S', 'White/XL', 'Black/M', 'Black/S']
The order that I actually need is:
["White/S","White/M", "White/L", "White/XL", "Black/S", "Black/M"]
So, in other words, I need the colors sorted alphabetically and the the sizes
sorted logically.
I looked for a while at using comparison functions with sort but I don't think
that will work. Anyone been down this road? Suggestions?
Thanks a million,
Derek
__________________________________
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.
http://promotions.yahoo.com/new_mail