Hi all,
Doing some XML processing in python. (Edit: I'm forced to use Python 2.4 for this project, boo!) I want to know what is the most Pythonic way to do this (create union of all values in multiple lists):
def getUniqueAttributeValues(xml_attribute_nodes):
# split attribute values by whitespace into lists
result_lists=list(item.getContent().split() for item in xml_attribute_nodes)
# find all unique values
unique_results=[]
for result_list in result_lists:
for result in result_list:
if result in unique_results:
continue
unique_results.append(result)
return unique_results
Thanks,
-aj