I'm fairly new to python, and I am trying to write a script that will write all the files in a directory to a text file, but only write the files that have a certain extension (.avi, .rmvb, .mkv etc.) and only print the filename without the extension. So video.avi would become video in the text file, and text.txt would be ignored completely. So far I have been able to list the directory using os.listdir, and write it to a text file, but haven't been able to show only certain extensions and show only the filename. What would be the best way of doing this?
0 · ·