Pythonで指定したディレクトリ内のファイル名リストを取得する
個人的なコードのメモ。備忘録
dir_name = "test_dir" json_file = "*.json" # 指定したディレクトリ内のjsonファイルの(./test_dir/*.json) # ファイル名(拡張子なし)をリストとして取得する file_names = [os.path.splitext(os.path.basename(f))[0] for f in glob.glob(os.path.join(os.getcwd(), dir_name, json_file))]