import os
import glob
path = input("Please enter the directory you want to get the files from. -> ")
for filename in glob.glob(os.path.join(path, '*.ppm')):
open("r", encoding="utf-8")
I am trying to open all .ppm files in a user given directory.
You keep trying to open a file named "r". Try adding the filename.
import os
import glob
path = input("Please enter the directory you want to get the files from. -> ")
for filename in glob.glob(os.path.join(path, '*.ppm')):
file_obj = open(filename, "r", encoding="utf-8")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.