While I need to test a condition whether some strings are existing in the list or not, I'm getting always same answer.
Like in below list I need to check for string "Inactive" or "Dead", if found print something.
list = [u'\u25cf multi-user.target - Multi-User System\n', u' Loaded: loaded (/lib/systemd/system/multi-user .target; static; vendor preset: enabled)\n', u' Active: active since Mon 2017-02-20 20:58:28 HKT; 1h 20min ago\n ', u' Docs: man:systemd.special(7)\n', u'\n', u'Feb 20 20:58:28 ubuntu systemd[1]: Reached target Multi-User S ystem.\n']
Code:
if 'Inactive' or 'Dead' in list:
print "Service not active"
Tried pouring the output to a file, variable etc, but nothing seemed to work. Have already gone through solutions over the web but no luck. Please help.