Bonjour,
Je lis une fichier ligne à ligne.
Ma condition est : Si on trouve tel mot non accompagné de tel mot alors on le garde, sinon on continue...
J'ai fait ça mais ça ne fonctionne pas très bien:
Merci par avance pour votre retour.
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 for line in FILE_CONTENT: if ('Santgr' or not 'auswertbar') in line.strip(): a=line[11:][:7].replace(' ','') Santgrkont=1 if ('Fantgr' or not 'auswertbar') in line.strip(): b=line[11:][:7].replace(' ','') Fantgrkont=1 if ('Sgrad' or not 'auswertbar') in line.strip(): c=line[11:][:7].replace(' ','') Sgradkont=1 if ('Fgrad' or not 'auswertbar') in line.strip(): d=line[11:][:7].replace(' ','') Fgradkont=1 if ('Smax' or not 'auswertbar') in line.strip(): e=line[11:][:7].replace(' ','') Smaxkont=1 if ('Fmax' or not 'auswertbar') in line.strip(): f=line[11:][:7].replace(' ','') Fmaxkont=1 if ('Sgrd-' or not 'auswertbar') in line.strip(): g=line[11:][:7].replace(' ','') Sgrdminuskont=1
Partager