- ##
- import os;
- def fa(dir):
- dst_dir = os.getcwd() + '/mp3/';
- lists = os.walk(dir);
- for root, dirs, files in lists:
- for file in files:
- pix = os.path.splitext(file);
- if 'amr' == pix[1][1:]:
- dst_file = dst_dir + pix[0] + '.mp3';
- src_file = root + '/' + file;
- cmd = 'ffmpeg -i ' + src_file + ' ' + dst_file;
- os.system(cmd)
- print('ok');
- fa('/root/python/amr');
- #该片段来自于http://www.codesnippet.cn/detail/2703201511999.html
来源: http://www.codesnippet.cn/detail/2703201511999.html