Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
def diffFile(path): firstFile=run("md5sum "+path) return firstFile
我想执行上述方法并在python的调用方法中获得返回“firstFile”到目前为止没有成功尝试了所有可能的方式。全局也无法将返回发送到主调用..织物创建另一个进程,所以还有其他选择吗?
只需使用 subprocess 模块来调用外部文件。调用外部文件时有几种方法可以处理不同的输出流。
def diffFile(path): return subprocess.check_output("md5sum "+path)