Created
November 28, 2022 14:22
-
-
Save hamaguchi-amago/135edb08e1141efae3416271d245469f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import glob | |
# * の場合 | |
print(glob.glob("working/*")) | |
print(glob.glob("working/*", recursive=True)) | |
# ** の場合 | |
print(glob.glob("working/**")) | |
print(glob.glob("working/**", recursive=True)) | |
# イテレータを取得する | |
print(glob.iglob("working/**", recursive=True)) | |
print(list(glob.iglob("working/**", recursive=True))) | |
# ディレクトリ名の一致を条件で付ける | |
print(glob.glob("working/**/sub*", recursive=True)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ブログで作成しました。
【Python】globを使ってファイルの一覧を取得する
https://neko-py.com/python-glob