Python: Directory Read
Read the contents of a directory of images. Exclude the non-image directory entries. Create a caption by deleting the file extension and capitalizing the file name.
The Python os.listdir function appears to show only the visible files, not the dot files, so we don't have to manually exclude the invisibles.
Choose a directory: Comics • Embroidery • Carving • Tech
![](../images/tech/Xcode.png)
![](../images/tech/Tomcat.png)
![](../images/tech/Eclipse.png)
![](../images/tech/Android Studio.png)
![](../images/tech/Angular.png)
![](../images/tech/C++.png)
![](../images/tech/Stack Overflow.png)
![](../images/tech/Perl.png)
![](../images/tech/Node.png)
![](../images/tech/Github.png)
![](../images/tech/Python.png)
![](../images/tech/MAMP.png)
We can change the order of the files (for example, birth order instead of alphabetical order) by prepending each file name with a number and removing the number from the caption string.
Images courtesy of:
Stone Paperweight at World of Judaica
Embroidery Designs at 4-Hobby.com
Dumbing of Age
Scary Go Round
Questionable Content