🏆 2024

맛집 분야 크리에이터

🏆 2023

IT 분야 크리에이터

👩‍❤️‍👨 구독자 수

182

✒️ 게시글 수

0
https://tistory1.daumcdn.net/tistory/4631271/skin/images/blank.png 네이버블로그

🩷 방문자 추이

오늘

어제

전체

🏆 인기글 순위

티스토리 뷰

728x90
반응형

 

 

 

 

파이썬에서 현재 디렉토리 경로에 있는 jpg 이미지파일명 목록으로 가져와 읽는방법입니다. 

 

import os

# 현재 디렉토리 경로를 가져옴
current_directory = os.getcwd()

# 현재 디렉토리에 있는 파일 목록을 가져옴
files_in_directory = os.listdir(current_directory)

# .jpg 확장자로 끝나는 파일만 필터링
jpg_files = [file for file in files_in_directory if file.lower().endswith('.jpg')]

print("현재 디렉토리 경로:", current_directory)
print("JPG 파일 목록:")
for file in jpg_files:
    my_image = Image.open(file)
728x90
반응형
댓글