If you open up a python interpreter, you'll find that "doc" and "pdf" and "xls" and "jpg" is the same thing as 'jpg':
>>> "doc" and "pdf" and "xls" and "jpg"
'jpg'
So rather than testing against all the strings, your first attempt only tests against 'jpg'.
There are a number of ways to do what you want. The below isn't the most obvious, but it's useful:
if not any(test_string in text for test_string in ["doc", "pdf", "xls", "jpg"]):
filtered.append(text)
Another approach would be to use a for loop in conjunction with an else statement:
for test_string in ["doc", "pdf", "xls", "jpg"]:
if test_string in text:
break
else:
filtered.append(text)
Finally, you could use a pure list comprehension:
tofilter = ["one.pdf", "two.txt", "three.jpg", "four.png"]
test_strings = ["doc", "pdf", "xls", "jpg"]
filtered = [s for s in tofilter if not any(t in s for t in test_strings)]
EDIT:
If you want to filter both words and extensions, I would recommend the following:
text_list = generate_text_list() # or whatever you do to get a text sequence
extensions = ['.doc', '.pdf', '.xls', '.jpg']
words = ['some', 'words', 'to', 'filter']
text_list = [text for text in text_list if not text.endswith(tuple(extensions))]
text_list = [text for text in text_list if not any(word in text for word in words)]
This could still lead to some mismatches; the above also filters "Do something", "He's a wordsmith", etc. If that's a problem then you may need a more complex solution.