簡體   English   中英

如何使用Twisted Python運行C程序並獲取程序輸出

[英]How to run a C program and get output of the program using Twisted Python

我有一個使用Twisted框架編寫的Python Bot,並且有一個輸出某些文本的C程序。 我將如何運行Twisted使用命令運行C程序,收集輸出,然后將輸出打印回我?

最簡單的方法是getProcessOutput

from twisted.internet.utils import getProcessOutput
df = getProcessOutput('ls', args=('/home','-lah'))
df.addCallback( printOutput )

如果您需要更復雜的內容,另請參見http://twistedmatrix.com/documents/current/core/howto/process.html

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM