python - Find b'' in command output? -
i'm trying find specific string command output in terminal. doesn't work however.
here command i'm running:
check = subprocess.check_output("netctl list | sed -n 's/^\* //p'", shell=true) that brings 1 of 2 things. if not connected, returns b'', otherwise returns b'$networkname\n'.
the code i'm using check follows:
p = re.compile(r"\bb''\b") if p.search("b''"): print("false") return false else: print("true") return true however, returns true no matter what. i've tried:
if check == "b''": but returns true no matter what. i'm losing mind here. causing not work?
thanks in advance,
cody
the fact should looking empty bytes literal b'', not string "b''".
if check == b'':
Comments
Post a Comment