import tensorflow as tf
data_dir = 'data/mini_speech_commands'
# 遍历文件夹data_dir下的'/*/*'文件
"""
遍历文件夹data_dir下的'/*/*'文件
返回文件路径列表
"""
filenames = tf.io.gfile.glob(
data_dir # 文件夹
+ '/*/*' # 文件
)
filenames
[‘data\mini_speech_commands\go\004ae714_nohash_0.wav’,
‘data\mini_speech_commands\go\11a022ba_nohash_1.wav’,
‘data\mini_speech_commands\go\1ecfb537_nohash_0.wav’,
‘data\mini_speech_commands\go\1ed557b9_nohash_0.wav’,
‘data\mini_speech_commands\go\1fd85ee4_nohash_0.wav’,
‘data\mini_speech_commands\go\20174140_nohash_1.wav’,]
type(filenames)
list