list1 = ['Вася.пидор', 'Петя.гной', 'Маша.шлюха', 'Саша.блядь', 'пека', 'йоба'];list2 = ['Вася', 'Петя', 'йоба'];print(list(set(list1) - set([el[1] for el in [(el2, el1) for el2 in list2 for el1 in list1] if el[0] in el[1]])))
Standard input is empty
['пека', 'Маша.шлюха', 'Саша.блядь']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!