Choisir aléatoirement une image dans « tabChoix » vous pourrai m'aider

Fermé
GABRIEL - Modifié le 28 mai 2020 à 20:31
samigtx1459 Messages postés 482 Date d'inscription vendredi 3 août 2012 Statut Membre Dernière intervention 13 janvier 2024 - 28 mai 2020 à 23:21
Bonjour,


tabChoix.append([resulat3])
print(tabChoix)

random=0

#c) c 'est ca que je sais pas faire si vous pouvez m aider
choisir aléatoirement une image dans « tabChoix » #ma liste marche

#for element in os.listdir("C:/Users/gabou/OneDrive/Bureau/tp6/sav eimage2")*:
random.choice(tbchoix)*
[i for i in range(1, 14) if i != derniere_valeur_choisie] # pour evite les meme img
# im=Image.open(Imageredimensionnee)
# disp.ShowImage(im)

Configuration: Windows / Chrome 83.0.4103.61
A voir également:

1 réponse

samigtx1459 Messages postés 482 Date d'inscription vendredi 3 août 2012 Statut Membre Dernière intervention 13 janvier 2024 67
28 mai 2020 à 23:21
Pour choisir aléatoirement il y a random.choice qui choisit un element d'une liste , random.randrange et random.randint pour un nombre généré aléatoirement (petite précision le dernier argument de randrange est la limite non comprise alors que randint comprend le 2eme argument.
0