1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import random
# on récupère les données du fichier
with open("FlashBanners.txt") as file_in:
data = file_in.readlines()
# end with
# petite boucle pour faire plusieurs essais
for i in range(10):
# on tire au sort une URL bannière
banner_url = random.choice(data)
# au pire on peut nettoyer un peu l'URL
banner_url = banner_url.strip()
# on l'utilise comme on veut
print("URL bannière choisie :", banner_url)
# end for |
Partager