我正在使用 Python RegEx 显示所有连接到计算机的互联网无线配置文件(TypeError: cannot use a string pattern on a bytes-like object)。我的第二行有错误,请任何人帮助识别我的错误。谢谢
我的程序
import subprocess,re
command = "netsh wlan show profile"
output = subprocess.check_output(command, shell=True)
network_names = re.search("(Profile\s*:\s)(.*)", output)
print(network_names.group(0))
Run Code Online (Sandbox Code Playgroud)
………………………………………………………………………………………………………………………………………………………… ...
错误
line 8, in <module>
return _compile(pattern, flags).search(string)
TypeError: cannot use a string pattern on a bytes-like object
Run Code Online (Sandbox Code Playgroud)