I am having 1 list "name_list".
name_list=['Name:Bill,Age:28,Height:6.1', 'Name:Dona,Age:23,Height:6.1','Name:Bill,Age:22,Height:6.1', 'Name:Shelly,Age:24,Height:7']
1) I want to sort the list with common datas. For example the output should come like this:
out=['Name:Bill,Age:28,Height:6.1', 'Name:Bill,Age:22,Height:6.1']
2) I want to sort the list with Max. Age. For example If I want to check out who is having max age output should come like this.
out=['Name:Bill,Age:28,Height:6.1']
This is what I have done till now:
name_list=['Name:Bill,Age:28,Height:6.1', 'Name:Dona,Age:23,Height:6.1','Name:Bill,Age:22,Height:6.1', 'Name:Shelly,Age:24,Height:7']
out = filter(lambda x:'Name:Bill' in x and 'Height:6.1' in x,list)
attributesare included in yourcommon datas?: 'Name:Bill,Age:28,Height:6.1', 'Name:Bill,Age:22,Height:6.1'?