我无法在python中检查某个文件类型的所有文件的目录,.wav是特定的.
我尝试了几种不同的方法来解决问题但似乎无法解决它.有没有办法在python中检查这样的目录?
这将列出所有文件名,然后检查它们是否以.wav结尾
import os listdirectory = os.listdir(".") # gets the name of all files in your dir for filename in listdirectory: if filename.endswith(".wav"): # check each of the files for whether or not they end in .wav