vendredi 2 décembre 2022

Random.Choices IndexError: list index out of range

I am getting IndexError: list index out of range, what is wrong in my syntax ?

   #Working  
   filenames = random.sample(fnmatch.filter(os.listdir(IMAGE_PATH), '*.png'))
   #Not working
   filenames = random.choices(fnmatch.filter(os.listdir(IMAGE_PATH), '*.png'), k=10)
 
   for image_file in filenames:

     //Code here



Aucun commentaire:

Enregistrer un commentaire