os.system()
用于运行其他程序或者脚本或者终端的命令
示例:
import os
cmd_str = 'touch 1.txt'
os.system(cmd_str)
import os
cmd_str = 'python phon_test.py'
os.system(cmd_str)
cmd_str = 'ffmpeg -f image2 -i {}/%05d.jpg -c:v copy {}'.format(osp.join(result_root, 'frame'), output_video_path)
os.system(cmd_str)
本文介绍Python中os模块的os.system()函数,展示如何用它来执行外部程序、脚本及终端命令。通过实例演示了创建文件、运行Python脚本及调用FFmpeg进行视频处理的过程。
2887

被折叠的 条评论
为什么被折叠?



