简体   繁体   中英

How to write this type of code in “vim test.py”

"!spleeter separate -o output/ converted.mp3"

I want to add this code to my python file where I have converted the video file into an audio file and now I am separating the music from vocals. This code works properly on the command line but I am confused about how to use it in a VIM file so that it may run simply by running the command "python3 test.py".

Thank you in advance

If you want to run terminal commands in python use subprocess library in python.

import subprocess 
subprocess.run(['!spleeter', 'separate', '-o', 'output/', 'converted.mp3'])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM