[Data Analysis]#3 glob vs. rglob

Clay Ryu's sound lab·2023년 4월 25일
0

Note for 2023

목록 보기
8/10

glob

from glob import glob

# use string for accessing a certain path
data_path = '/home/clay/userdata/BeatlikeMichael/drumVAE-main/groove/drummer1'

# both glob and rglob can access to number of directory by using *
for dir_path in glob(data_path+'/session*'):
  for file_path in glob(dir_path+'/*.mid'):

rglob

from pathlib import Path

# use Path
data_path = Path('/home/clay/userdata/BeatlikeMichael/drumVAE-main/groove/drummer1')

# much easier to search for certain data with a certain format
for file in data_path.rglob('*.mid'):

profile
chords & code // harmony with structure

0개의 댓글