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
  • 315
  • 1
  • 3
  • 9

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
  • 13,980
  • 4
  • 22
  • 50