-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathRead_jenkins_OT.py
More file actions
32 lines (21 loc) · 817 Bytes
/
Read_jenkins_OT.py
File metadata and controls
32 lines (21 loc) · 817 Bytes
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
#lire le fichier jenkins.dat avec la commande with open(filename) as file
#ouvrir un fichier <votre_nom>.ret en ecriture
#avec une liste comprehension selectionner que les lignes qui contiennent WARNING
#ecrire toutes ces lignes dans le fichier <votre_nom>.ret
#files setting
file = open("jenkins.dat","r")
output = open("Tran_Olivier.ret", "w")
#split file in lines
data = file.read().split("\n")
#split lines in sub elements
for x in range(len(data)):
data.append(data[x].split("\t"))
#looking for warnings and writing in new file
for x in range(len(data)):
for y in range(len(data[x])):
if data[x][y].find("WARNING") != -1:
line = str(data[x]).replace("[","").replace("]","")
print("warning found:",line)
output.write(line)
file.close()
output.close()