I am trying to create a script that searches for the file in directory and if the file exists then play it. but I ran into a problem. Suppose when I enter the song name "car" but the file name is "caar, new punjabi song 2022.mp3", then it does not do anything. Is there any way to play similar files. The code is something like this:-
song_name = input("Please enter the song name: ")
for file in os.listdir(music_path):
if song_name in file:
print("Here you go!")
speak("Here you go")
print("Playing: ", song_name)
speak("Playing")
speak(song_name)
finalfile = os.path.join(music_path, file)
os.startfile(finalfile)
break