私信  •  关注

thehole

thehole 最近创建的主题
thehole 最近回复了

如果你不需要用管道把bash导入python,也许这适合你的喜好?

['python','-c','print("this is a sample text")'].execute().text

如果你 需要它,试试看

['bash','-c', /echo print\(\"this is a sample text.\"\) | python/].execute().text

使用 List .execute() 有助于澄清每个论点是什么。斜杠字符串通过更改转义符来帮助实现。