[英]Python - How would a person open every .ppm file in a directory
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")
我正在嘗試打開用戶給定目錄中的所有.ppm文件。
您一直試圖打開一個名為“ r”的文件。 嘗試添加文件名。
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")
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.