count
sample_audio = []
total = 0
for x in subFolderList:
# 获取所有wav文件
all_files = [y for y in os.listdir(audio_path + x) if '.wav' in y]
total += len(all_files)
sample_audio.append(audio_path + x + '/'+ all_files[0])
# print(sample_audio)
# 查看每个子文件夹文件数量
print('%s : count: %d ' % (x , len(all_files)))
查看wav文件总数
print("TOTAL:",total)
输出结果:
bed : count: 10
bird : count: 15
cat : count: 17
dog : count: 20
down : count: 36
eight : count: 16
five : count: 16
four : count: 22
go : count: 18
happy : count: 16
house : count: 15
left : count: 20
marvin : count: 19
nine : count: 14
no : count: 16
off : count: 20
on : count: 11
one : count: 18
right : count: 22
seven : count: 20
sheila : count: 17
six : count: 15
stop : count: 12
three : count: 19
tree : count: 14
two : count: 12
up : count: 10
wow : count: 18
yes : count: 17
zero : count: 20
_backgroundnoise : count: 6
TOTAL: 521