if 'PASSED' in cell.value or 'FAILED' in cell.value or 'INVALID' in cell.value:
Test.append(6)
What is a more concise way to do this? I want to make it do something like
if cell.value in ('PASSED','INVALID', 'FAILED')
but that doesn't work
if 'PASSED' in cell.value or 'FAILED' in cell.value or 'INVALID' in cell.value:
Test.append(6)
What is a more concise way to do this? I want to make it do something like
if cell.value in ('PASSED','INVALID', 'FAILED')
but that doesn't work
Use the any()
function and a generator expression:
if any(s in cell.value for s in ('PASSED','INVALID', 'FAILED')):
This tests each string in turn, returning True
as soon as a test passes.