You could use the followingm, where the_list is your list. (I'm new to python so there might be a better way):
toremove = [] for x in the_list: for y in the_list: if y.startswith(x) and y != x: toremove.append(y) difference = filter(lambda x:x not in toremove, the_list) -- http://mail.python.org/mailman/listinfo/python-list