If you have more than two values (91 and 18)
or they are dynamically produced
it is better to use this construction:
[i for i in my_list if not i.startswith(('91', '18'))]
Or if you want to check if 91
and 18
are in the strings (not only in the beginning), use in
instead of startswith
:
[i for i in my_list if all(x not in i for x in ['91', '18'])]
Example of usage:
>>> my_list = ['91 9925479326','18002561245','All the best','good']
>>> [i for i in my_list if all(not i.startswith(x) for x in ['91', '18'])]
['All the best', 'good']
>>>