0

Look ath this example

if ('.NET' or 'JS' or 'python' or 'Java') not in title:
    print(title)

It's a part of my code. Title is a string. I want to display title only if not contain any one element of the list. In this example it only exculdes .NET. How can I solve my problem?

wtsuport
  • 49
  • 3

1 Answers1

0

You need to rewrite your statement in this way:

if ('.NET' not in title and
    'JS' not in title and
    'python' not in title and
    'Java' not in title):

Or:

if all(x not in title for x in ('.NET', 'JS', 'python', 'Java')):
Riccardo Bucco
  • 11,231
  • 3
  • 17
  • 42