8/26/2022

finding all specific extension file in all subfolder from starting directory

 refer to example code

..

import os
from glob import glob

start_dir = '/start/folder' #os.getcwd()
pattern = "*.jpg" #file extension which you want to find

for dir,_,_ in os.walk(start_dir):
print( glob(os.path.join(dir,pattern)) )

..


Thank you.

www.marearts.com


8/25/2022

use easy attribute class using "argparse", "ArgumentParser"

 see the example code

.

import argparse

#define as default
paser = argparse.ArgumentParser()
args = paser.parse_args("")

#assign values
args.cuda = False
args.device = 'cpu'

#print
print(args)
print(args.cuda)

.


Thank you.

www.marearts.com