파이썬, 대화 상자에서 파일 선택하기
from tkinter import filedialog as fd
# 파일 선택 상자 출력해서 선택한 파일 경로 얻기
path = str = fd.askopenfilename(title='Select a file')
print(path)
path = str = fd.askopenfilename(
title='Select a file',
initialdir='/Users/',
filetypes=(("오피스 문서", "*.docs;*.doc;*.xlsx;*.pptx;**.ppt"),
("모든 파일", "*.*"),
)
)
print(path)
[화면] Windows에서 파일 탐색기 동작
반응형
'Python 활용' 카테고리의 다른 글
Kivy 파이썬 App (0) | 2025.03.07 |
---|---|
Python 3.13에서 GIL을 제거하면 빨라질까? (0) | 2025.02.16 |
AttributeError: module 'bcrypt' has no attribute '__about__' 오류 발생 시 (0) | 2025.01.28 |
파이썬, PyVisual - GUI 빌더 (0) | 2025.01.08 |
FastAPI + SQLModel (1) | 2025.01.04 |