I have two lists:
big_list = [2, 1, 2, 3, 1, 2, 4]
sub_list = [1, 2]
I want to remove all sub_list occurrences in big_list.
result
What you are trying to achieve can be done by converting it into list of strings and after replacing again convert it to integer type.
In a single line you can do it like this
map(int,list(("".join(map(str, big_list))).replace("".join(map(str, sub_list)),'').replace(''.join((map(str, sub_list))[::-1]),'')))
Input
big_list = [1, 2, 1, 2, 1]
sub_list = [1, 2, 1]
Output
[2, 1]
Input
big_list = [2, 1, 2, 3, 1, 2, 4]
sub_list = [1, 2]
Ouput
[2, 3, 4]