Sorting and list comprehension
Tran Tuan Anh
anhtt at hotmail.com
Sun Oct 10 10:41:06 CEST 2004
I would like to do the followings, but I am quite new to Python hence
have not figured it out how...
salary = dictionary
salary["Bob"] = 11
salary["Marry"] = 4
How can I have a sort_value() function acts like this:
result = sortvalue(salary)
result = ["Marry","Bob","me"]
In sort, I would like to sort the key according to the values.
Regarding the list construction, how can I do this:
list = [item for item in list1 if for all item2 in list2 NOT
Anyone has any idea?
Thanks a lot!
More information about the Python-list