title: Print a line if it matches AND if a condition is met in the N lines before and N lines after
body: <p>what is the most sensible way of doing this? Once I have my match, I want to know what's happening in the 100 lines before, and in the 100 lines after. Here is the example of the loop</p>
  
  <pre><code> with open(pile, "r") as pileup:
              for i, line in enumerate(pileup):
                  fields = line.split('\t')
                  if fields[0] == v.CHROM and (v.start -1) == fields[1]:
                          print(str(v)) #printing the query string #I hope that then the variable i has the value of the match line number
                          for line in range(i-101, i+101):
                              if fields[2] &gt;= 4:
                                   print (line)     #here I want to pring the line meeting the condition
  </code></pre>
  
  <p>I know using enumerate should allow to have a line number. But my code doesn't seem to work, it runs forever. 
  Thanks for any tips                 </p>