ディレクトリ内のすべての mps ファイルを抽出する単純な for ループを作成します。
for root, dirs, files in os.walk(rootDir, topdown='true'):
# filter the file names
for filename in files:
print(filename); # this prints out filenames as expected
print([file for filename in files if file[-4:] == '.mp3'])
私は得る:
TypeError: 'type' object is not subscriptable
何か案は?