I have the following if loop:
for line in content[:-1]:
# if the line has No Data in it
if line.find("No Data"):
line = line.replace("No Data", "0")
What the if loop does is to read every line of a list called "Content" and whe it detects the words "No Data" it subtitutes them for a Zero value. What I would like to do is to Count how many times this Change is done; I've tried with the following:
ctr=0
for line in content[:-1]:
if line.find("No Data"):
line = line.replace("No Data", "0")
ctr +=1
But what I got is that crt equals the total value of lines instead the number of times that that Change is done.
Aucun commentaire:
Enregistrer un commentaire