Mar-02-2021, 03:27 PM
Try this and let me know it that's what you want it to do.
Essayez ceci et faites-moi savoir que c’est ce que vous voulez qu’il fasse.
Essayez ceci et faites-moi savoir que c’est ce que vous voulez qu’il fasse.
def livre(nom) : with open (nom,"r",encoding="utf8") as fichier : contenu = fichier.read() texte1 = contenu.split('\n') doc = [['préliminaire','']] for ligne in texte1 : ok=ligne.find("*") if ok == 0 : doc.append([ligne[1:].strip(),"" ]) else: doc.append([ligne[0:]]) print (doc)