def get_ninja_file(path, extension, only_first=False):
 files = os.listdir(path)
 if (not extension.startswith('.')):
  extension = '.'.join(extension)
 found = list([y for y in files if y.endswith(extension)])
 if only_first:
  found = (found[0] if found else [])
 return found

def get_ninja_file ( path , extension , only_first = False ) : files = os . listdir ( path ) if ( not extension . startswith ( '.' ) ) : extension = '.' . join ( extension ) found = list ( [ y for y in files if y . endswith ( extension ) ] ) if only_first : found = ( found [ 0 ] if found else [ ] ) return found
search and return the files with extension in the folder: path .