Bonjour à tous,
Je début en python et je voudrais réaliser un projet simple.
j'ai un fichier HTML dans lequel je voudrais aller chercher des valeurs.
Voici mon code python :
Il fonctionne bien, il chercher dans ma page ma chaine "AD" puis l'affiche, mais je voudrais aller plus loin en affichant tout le texte qu'il y a derrière jusqu'au prochain "<"
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 chaine = "AD " # Texte à rechercher fichier = open("index.html","r") for ligne in fichier: if chaine in ligne: print (chaine) fichier.close()
exemple de mon code html :En gros je voudrais qu'il m'affiche : "AD (98,8%)"
Code : Sélectionner tout - Visualiser dans une fenêtre à part <span id='sorttable_sortfwdind'> ▾</span></td><td>AD (98.8%)</td><td>SEP (100.0%)</td>
Je ne trouve pas comment lui faire affichier ce qu'il y a après ma chaine.
Vous avez une piste a me donner?
Merci :)
Partager