0

I am trying to check for multiple strings in a line,am trying to do the following but the check fails when the line contains 'Change-Id' or 'N/A',please advise

line = 'N/A'
if (('Change-Id|N/A') not in line):
    print line
else:
    print "line check failed"
user3508811
  • 847
  • 4
  • 19
  • 43
  • Will the line always exactly equal the strings you're checking for? Or are you testing for substrings? If you're testing entire strings, you can do `if line not in ['N/A', 'Change-Id']`, otherwise you'd be best suited with an `or` statement. Unless your test strings are complicated, in which case you might need regex. – tblznbits Sep 04 '18 at 18:59
  • @brittenb - the strings am checking for is a substring of the line – user3508811 Sep 04 '18 at 19:01

0 Answers0