Anhoter HURRA for list comprehensions: >>> a = ['a', 'b', 'c', 'd'] >>> b = ['a','c'] >>> [x in b and x.upper() or x for x in a] ['A', 'b', 'C', 'd']
Is what you want? Cheers Gerardo >I'm trying to compare the list with another list and if it is there in >both I'm changing it to upper case and adding to another list and if >its not there in both I just want to add it to the global list (ie >files). >I'm able to do the first part but when I'm doing the second part the >files which are not there in both are getting repeatedly into the >global file. Some one help me so that >If ab = [a,b,c,d] >and cd = [a,c] >my global list file should be [A,b,C,d] > > > -- http://mail.python.org/mailman/listinfo/python-list