Bonjour !
depuis le début de l'après midi je suis en train de faire mon script python, mais là je bloque à la ligne 17 :
c'est pas important de tout lire car je vais simplifier où j'ai besoin d'aide :
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
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41 import os for h in os.listdir('./'): if (h.split('.')[-1] != "brres" or "bin"): continue print(f"replacing in {h}") ha = open(h, "r+b") backup = ha.read() c = h.split('.')[0] d = open(c, "r+b") os.rename(c,f"{name}_backup.brres") d.seek(0x0) d.write(backup) d.close() texte = "TEX0" for hb in h: for texte in hb: #il me faut l'adresse de tous les texte trouvés et les mettre dans une liste# hc = input("texture name with extension : ") hd = open(hc, "r+b") he = input("texture position : ") hf = liste[he]+64 ha.seek(hf) ha.write(hd) hg = he+1 ha.seek(hg) hh = ha.read(4) b0 = hh[0] b1 = hh[1] b2 = hh[2] b3 = hh[3] if (b0==84 and b1==69 and b2==88 and b3==48): print("Success, close this script if you have nothing else to change.") continue #on est d'accord ça me remet à la ligne 16 "for texte in hb"# else b = d.read() ha.seek(0x0) ha.write(d) print(f"file not modified, wrong settings for {hc}") pause_du_bled = input("press enter to exit.") exit
à partir de la ligne 17, un fichier est ouvert et je voudrais savoir toutes les adresses où "TEX0" est écrit et les mettre dans une liste (que j'ai appelée "liste" dans mon script)
aussi, juste pour être sûr, le "continue" de la ligne 33 me ramène bien à la ligne 17 ? sinon comment faire ?
Partager