I am looking for a more efficient way (if available) to split a list into two sub-lists. An example of the original list:
full_list = ['t1', 't2', 't3', 't4', 't5', 'v1', 'v2']
NOTE: In general the original list contains an arbitrary amount of elements that are mixed together. The 't1' ... 't5' just serve to indicate elements of the first sub-list:
t_sub_list = ['t1', 't2', 't3', 't4', 't5']
This sub-list is a given.
I would like to most efficiently generate the second sub-list:
v_sub_list = ['v1', 'v2']
The solutions that come to my mind are:
v_sub_list_A = [list_element for list_element in full_list if list_element not in t_sub_list]
v_sub_list_B = list(set(full_list) - set(t_sub_list))
The question I have is - is there any more efficient way of doing this? Or at least any package that would allow to achieve the result in a more code-readable fashion?