python - 从 bash 子进程获取 bash 代码日志
问题描述
我正在使用子进程模块 EG 从 python 运行一些 bash 代码
import subprocess
container_logs = 'az container logs --name textgeneratorinference'
subprocess.call([container_logs],shell=True)
从那里我得到一个 0 响应,表示代码已执行,但是当我在终端中运行同样的代码时,我收到一条消息 EG:
Login Succeeded
WARNING! Your password will be stored unencrypted in .
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
我怎样才能把它变成一个python变量?
解决方案
推荐阅读
- python - if函数不与while循环通信
- python-3.x - 带有 Selenium 的 Python - 选择选项在运行模式下工作时无法在调试模式下工作(VS Code)
- windows - 想要为无限循环运行 JMeter 测试脚本但不工作
- python - 如何使用 Python 函数对嵌套列表中的每个列表求和?
- rust - 如何在有条件地修改外部选项时返回对选项内部值的引用
- c# - 从 dapper 中的多个查询返回可枚举的结果
- json-deserialization - com.fasterxml.jackson.databind.exc.MismatchedInputException:无法从 START_ARRAY 令牌中反序列化“Todo”实例
- ros - 将 ROS 发布者缓冲区设置为 1 并将订阅者缓冲区设置为 1000 是否足够并且仍然不会丢失任何消息
- azure - Azure 管道运行时替换表达式
- .net-core - 有没有更好的方法在 Startup 类的 ConfigureServices 方法中注入所有依赖项