I can't see what i am doing wrong here
import os
def check():
path = "d://Mu$ic//"
for file in os.listdir(path):
if file.endswith("*.mp3"):
print (os.path.join(path,file))
check()
The output doesn't show up , any idea what am i doing wrong?
Omitting the *
should work, since endswith
matches on a string suffix (as opposed to *.mp3
which is a wildcard):
file.endswith(".mp3"):
Also, you could replace //
with just /
.