Bonjour a tous

je recupere ce code python:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import re
 
textos = "eada008.mrk"
traducciones = "dico.utf8.txt"
salida = "eada008650.mrk"
with open(textos, 'r') as text, open(traducciones, 'r') as trad, open(salida, 'w') as salida:
    trad_lineas = dict(tr.strip().split(':', 1) for tr in trad.readlines() if ':' in tr)
    for linea in text:
        match = re.search(r'^=650.*\$a(.*)$', linea)
        if match:
            palabra = match.group(1).rstrip()
            if palabra in trad_lineas:
                linea = "=650  \\\\$a{}$i{}\n".format(palabra, trad_lineas[palabra])
        salida.write(linea)
Ce code sert a joindre 2 fichiers:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
textos = "eada008.mrk"
traducciones = "dico.utf8.txt"
dans le fichiers eada008.mrk il existe un champ 650 $a
comme vous pouvez voir dans cet exemple:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
=LDR  00537nam a2200217   4500
=001  1
=008  030213s1999\\\\xxx|||||\||||\00|\0\eng\d
=041  \\$aeng
=093  \\$a13/02/2003
=100  \\$aCrainer, Stuart$97117
=245  10$aGravy training$binside the business of business schools$cStuart Crainer, Des Dearlove ; Crainer, Stuart ; Dearlove, Desmond
=260  \\$aSan Francisco$bJossey-Bas$c1999
=300  \\$a200 p
=338  \\$aLibro
=546  \\$aInglés
=650  \\$aArte
=700  \\$aDearlove, Desmond$97504
=942  \\$n0
=953  1cv
=953  2cv
=999  \\$c22630$d22630
et dans le deuxieme fichier il existe une ligne avec la même valeur ici Art.
voici un fragment:
Arrendamientos urbanos:Urban rental
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
Arte:Art
Arte dramático:Dramatic art
Artes:Arts
Le resultat apres aplique ce script est ceci:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
=LDR  00537nam a2200217   4500
=001  1
=008  030213s1999\\\\xxx|||||\||||\00|\0\eng\d
=041  \\$aeng
=093  \\$a13/02/2003
=100  \\$aCrainer, Stuart$97117
=245  10$aGravy training$binside the business of business schools$cStuart Crainer, Des Dearlove ; Crainer, Stuart ; Dearlove, Desmond
=260  \\$aSan Francisco$bJossey-Bas$c1999
=300  \\$a200 p
=338  \\$aLibro
=546  \\$aInglés
=650  \\$aArte$iArt
=700  \\$aDearlove, Desmond$97504
=942  \\$n0
=953  1cv
=953  2cv
=999  \\$c22630$d22630
C'est a dire sa traduction avec $i devant.
Le script marche super bien, mais voila, le fichier d'origine maintenant a ete changé et n'etant pas developpeur, je ne sais pas comment evaluer ce changement.
Le nouveau champs 650 $a ressembe a ceci maintenant:

Voyez, a ete ajouté un sous champs $9 245
Je voudrais donc faire pareil maintenant mais avec ce $9 en plus.
le resultat final serai:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
=650  \\$aArte$9245$iArt
Quelqu'un peu m'aider?

D'avance merci