I have a folder within my Python project folder that contains around 400 images. I'd like to be able to write a Python script that can access the folder and then pull all of the filenames and print them to the console.
I have the below code, but when I run it I get the error message FileNotFoundError: [WinError 2] The system cannot find the file specified: '/images/'
What do I need to do to fix this? The folder name and os.chdir() parameters are correct.
import glob, os
os.chdir("/images/")
for file in glob.glob("*.png"):
print(file)