Using list comprehension and regex (assuming all your datapoints start with ED):
my_list=['EDZ8 comdtyEDM1 comdtyEDU1 comdty, EDZ8 comdtyEDM1 comdtyEDZ1 comdty, EDZ8 comdtyEDM1 comdtyEDH2 comdty']
string_lists = [x.split(',') for x in my_list]
final_list = [[re.findall(r'ED\w+ comdty', string) for string in string_list] for string_list in string_lists]
This way it will perform this process for how ever many elements are in 'my_list'. In this case, since there is only one, the output will be
[[['EDZ8 comdty', 'EDM1 comdty', 'EDU1 comdty'], ['EDZ8 comdty', 'EDM1 comdty', 'EDZ1 comdty'], ['EDZ8 comdty', 'EDM1 comdty', 'EDH2 comdty']]]
Which is a list of list of lists. final_list[0]
is the first string in the list my_list
split into the list of lists you want, so if you have in the future a list had 2 strings in it, you would have elements final_list[0]
and final_list[1]
The difference between this and The other answer here is that this will work without an existing knowledge of the length of the each string in your list. The other answer is also valid, but this will protect against variable lengths in the string