subprocess

    result = subprocess.Popen(s.format(mp3files), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
    out = result.stdout.read()
    temp = str(out.decode('utf-8'))

  

 17.5. subprocess — Subprocess management — Python 3.5.5 documentation  https://docs.python.org/3.5/library/subprocess.html

Source code: Lib/subprocess.py


The subprocess module allows you to spawn new processes, connect to their input/output/error pipes, and obtain their return codes. This module intends to replace several older modules and functions:

os.system
os.spawn*

Information about how the subprocess module can be used to replace these modules and functions can be found in the following sections.

原文地址:https://www.cnblogs.com/rsapaper/p/9010882.html