環境
VSCode
バージョン: 1.98.2
コミット: ddc367ed5c8936efe395cffeec279b04ffd7db78
日付: 2025-03-12T13:32:45.399Z
Electron: 34.2.0
ElectronBuildId: 11161602
Chromium: 132.0.6834.196
Node.js: 20.18.2
V8: 13.2.152.36-electron.0
OS: Darwin arm64 24.3.0
Python 3.10.16
Pythonでローカルファイルのパスを取得する
①特定のフォルダ直下のすべてのファイルパスを取得する
img_names = Path(DATA_DIR + "train/").glob("*.png")
①特定のファイルパスを取得する
# ベタ書でももちろんok
img_name = f'{DATA_DIR}train/{image_id}.png'