X-Git-Url: http://gitweb.pimeys.fr/?p=bots%2Fhung.git;a=blobdiff_plain;f=convert_dico.py;h=75f805fba409c81c30562f1b4f3e4188f225e466;hp=1e5d187736d37449f574b0728931fa4bbbf7ae56;hb=HEAD;hpb=c3f4e4d4a35613531475e7cfec95cf76021e8a5d diff --git a/convert_dico.py b/convert_dico.py index 1e5d187..75f805f 100644 --- a/convert_dico.py +++ b/convert_dico.py @@ -44,15 +44,15 @@ def maju(texte): texte=texte.replace(avant,apres) return texte.upper() -l=[[maju(i[0]),i[1].replace("\\n","; ")] for i in l - if len(i[0])>=8 and not " " in i[0]] -print l[0] -print l[1] -print l[2] +l=[[maju(i[0]),i[0]+" : "+i[1].replace("\\n","; ")] for i in l + if len(i[0])>=8 + and not " " in i[0] + and not i[0][-1]=='-'] # les mots finissant par un tiret foiraient + # en plus ils sont pas intéressants, donc on vire f1=open("mots.txt.out","w") f2=open("definitions.txt.out","w") f1.writelines([(i[0]+"\n").encode("utf8") for i in l]) -f2.writelines([i[1]+"\n" for i in l]) +f2.writelines([i[1].decode("utf8").replace(u"note",u"nøte").replace(u"Note",u"Nøte").encode("utf8")+"\n" for i in l]) f1.close() f2.close()