python - How does the subprocess module return the contents of the executable file?
给我你的怀抱
给我你的怀抱 2017-05-18 10:58:55
0
2
697

The following code calls mplayer to play local audio files. Can the data in the filepath file be obtained through p?

p=subprocess.Popen(["mplayer",filepath],shell=False,stdin=subprocess.PIPE,stderr=subprocess.PIPE)

filepath It may also be a url, where the data is needed, but you don’t want to access this address again.
-------Supplement-------
I followed up when trying to debug, and wanted to see if the file content was obtained before calling mplayer, but in the subprocess module, the single Step debugging does not work, so I want to know if the subprocess module has obtained the data before calling mplayer. If so, it can obtain the data.

给我你的怀抱
给我你的怀抱

reply all(2)
黄舟

subprocess只是一个调用命令的库, 它的stdin, stdoutIt only stores the results of the command output. If your command has results, text or other output during execution, you can get it, but if you want to parse this audio file, it probably won't work. , or you need other parsing methods to explain, or open the file directly, maybe you can get what you want

小葫芦

It seems that what you want to get is the metadata of the audio data. If it is actually MP3, you can try the ID3 library.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!