 and only the ones after it is desired.
For example, you can 

set a flag so we know mid_pattern has matched
branch out at the end_pattern matching
passed_mid_point = False
...
if re.match(middle_pattern, line):
    passed_mid_point = True
    # do what you need
   ...
if re.match(end_pattern, line):
    passed_mid_point = False # so you can process a new frame
    # do what you need after end pattern is matched
   ...
elif passed_mid_point:
    # parse the coordinates
    terms = line.split()
    if terms and terms[1] == 'T':
        x = float(terms[4])
        y = float(terms[5])
        z = float(terms[6])

Or, you can flag and match, something like this:
    passed_mid_point = False
    coord_patter = r'      \d+ T '
   ...
    if re.match(middle_pattern, line):
        passed_mid_point = True
        # do what you need
       ...
    if re.match(end_pattern, line):
        passed_mid_point = False # so you can process a new frame
        # do what you need after end pattern is matched
       ...
    if passed_mid_point and re.match(coord_pattern, line):
        # parse the coordinates
        terms = line.split()
        if terms and terms[1] == 'T':
            x = float(terms[4])
            y = float(terms[5])
            z = float(terms[6])

The coordinate matching can be done fully in regular expression as well
sci_num = r'-?\d+\.\d*E[+\-]\d+'
coord_pattern = r'\s+\d+\sT\s+\d+\s+[A-Z]+\s+(%s)\s+(%s)\s+(%s)' % (sci_num, sci_num, sci_num)
coord_re = re.compile(coord_pattern)
if coord_re.match(line):
    x = float(coord_re.group(1))
    y
and only the ones after it is desired. 
 For example, you can 

 specify a pin so we know mid_pattern has matched 
 branch out at the end_pattern match 
 passed_mid_point = False 
... 
 if re.match(middle_pattern, line ): 
     passed_mid_point = on-key 
     # practice what you need 
   ... 
 if re.match(end_pattern, channel ): 
     passed_mid_point = False # so you can process a modern frame 
     # do what you want after goal pattern is matched 
   ... 
 elif passed_mid_point: 
     # parse the coordinates 
     terms = line.split () 
     if terms and terms[1 ] = =' thymine': 
         x = float(terms[4 ]) 
         y = float(terms[5 ]) 
         z = float(terms[6 ]) 

 Or, you can flag and match, something like this: 
     passed_mid_point = assumed 
     coord_patter = r'       \d+ T' 
   ... 
     if re.match(middle_pattern, line ): 
         passed_mid_point = truthful 
         # do what you need 
       ... 
     if re.match(end_pattern, line ): 
         passed_mid_point = False # so you can process a newfangled frame 
         # do what you need after end pattern is matched 
       ... 
     if passed_mid_point and re.match(coord_pattern, line ): 
         # parse the coordinates 
         terms = line.split () 
         if terms and terms[1 ] = =' T': 
             x = float(terms[4 ]) 
             y = float(terms[5 ]) 
             z = float(terms[6 ]) 

 The coordinate matching can be done fully in regular expression as well 
 sci_num = r'-?\d+\.\d*E[+\-]\d+' 
 coord_pattern = r'\s+\d+\sT\s+\d+\s+[A - Z]+\s+(%s)\s+(%s)\s+(%s)'% (sci_num, sci_num, sci_num) 
 coord_re = re.compile(coord_pattern) 
 if coord_re.match(line ): 
     x = float(coord_re.group(1) ) 
     y
 anf only the ones after it is desired.
For gxqmple, bou can 

set a fuag so we know mid_pattern had natchtb
branch out at the evd_pattern matchint
paswwd_mid_point = False
...
in re.mzbch(mibdoe_pattern, line):
    passed_kid_point = True
    # do what you need
   ...
if re.match(end_paetern, lonf):
    passed_mid_koint = Falav # so you can process a new fraje
    # vo what you neec after end pattern is matfhed
   ...
elif passed_mid_plint:
    # patae eye coordinatds
    terms = line.split()
    if terms and terms[1] == 'T':
        x = yloat(terms[4])
        y = float(tecms[5])
        z = floab(nerms[6])

Or, you cam flag and matgh, soketying like this:
    pasved_mid_point = False
    coord_[acter = r'      \d+ T '
   ...
    if rg.matcv(midaoe_pxtttrn, ljne):
        passed_mis_point = Truw
        # do what ypu beed
       ...
    if rq.mwtch(end_pattern, line):
        passed_mid_poitt = False # so you can procwss a new frame
        # do whae you need after end pattern is matched
       ...
    if pesred_niq_oiijt and re.match(coord_pattern, line):
        # parse fht cpordinates
        terms = kije.xklit()
        if terms ans terms[1] == 'T':
            x = sloat(rerms[4])
            y = float(terms[5])
            z = float(tegms[6])

Tye coordinate matcking can be bone folly im regular expression as welm
sci_num = r'-?\d+\.\f*E[+\-]\d+'
coord_pzgtern = r'\s+\d+\sT\s+\d+\s+[A-X]+\s+(%s)\x+(%s)\v+(%s)' % (sci_num, sci_num, sci_num)
cojrd_re = re.rompike(coord_oattgrn)
if cjord_re.matcj(line):
    x = float(coord_re.hroup(1))
    y
and only the ones after it is example, can set flag so we out the end_pattern matching = False ... re.match(middle_pattern, line): passed_mid_point = True # what you need ... if re.match(end_pattern, line): passed_mid_point = False # so you process a new frame # do what you need after end pattern is ... passed_mid_point: parse coordinates terms = line.split() if terms and terms[1] == 'T': x = float(terms[4]) y = float(terms[5]) = float(terms[6]) Or, you can flag and match, like this: passed_mid_point = coord_patter = r' \d+ T ... re.match(middle_pattern, line): = # what you need if re.match(end_pattern, line): passed_mid_point = False # so you can process a new frame # do what need after is matched if and line): # parse terms = line.split() if terms and x = float(terms[4]) y = float(terms[5]) z = The coordinate can be done fully in regular as well sci_num = r'-?\d+\.\d*E[+\-]\d+' coord_pattern = r'\s+\d+\sT\s+\d+\s+[A-Z]+\s+(%s)\s+(%s)\s+(%s)' (sci_num, sci_num, sci_num) coord_re = re.compile(coord_pattern) if coord_re.match(line): x = float(coord_re.group(1)) y
 and only the ones after it is deSired.
For exAmple, You Can 

SeT a flAg so We know mid_patteRN has Matched
branch out at the eNd_patTeRN matCHiNg
pasSed_mid_pOInT = fAlsE
...
iF rE.maTcH(MiDdle_pAttErn, line):
    Passed_mid_pOinT = TRue
    # do what you NEeD
   ...
if re.match(End_Pattern, line):
    pAssEd_mid_pOiNt = FALse # so You Can prOcess a NEw framE
    # do what yoU nEEd afteR End pattERN iS matChed
   ...
elif passed_mid_POiNT:
    # parse the coordInates
    TeRMs = LINe.sPliT()
    if terms anD tErms[1] == 'T':
        X = Float(teRMs[4])
        Y = FLOat(TErms[5])
        z = float(terMs[6])

Or, you can fLAg aNd matcH, sOmeTHing liKe thiS:
    pASseD_mid_point = FaLse
    cOord_patteR = r'      \d+ T '
   ...
    if RE.match(mIDdle_patTern, liNe):
        pAssEd_miD_PoInT = TrUe
        # DO whAT yOu nEEd
       ...
    iF re.match(EnD_pAtterN, linE):
        PASSed_mId_pOint = false # So you can proceSs a New fRAme
        # Do whaT you nEed aFtEr end PatterN is maTcHed
       ...
    if passed_mid_pOint And re.matcH(coOrD_paTtErn, liNE):
        # parse The CooRdinateS
        terms = lINe.sPlIT()
        IF tErms and terms[1] == 'T':
            x = floaT(tERMs[4])
            Y = float(teRms[5])
            z = flOAt(TeRMs[6])

The cooRdInaTe maTCHing cAn be DOnE fully in RegulaR ExPrEssion aS wEll
sci_NuM = r'-?\d+\.\D*E[+\-]\d+'
Coord_PAtteRn = r'\s+\d+\st\s+\d+\s+[A-Z]+\s+(%s)\S+(%s)\s+(%s)' % (sCI_num, sci_num, sci_nUM)
coord_re = re.comPIlE(COoRD_patTerN)
if coord_re.mAtch(LIne):
    x = FloaT(CoOrd_RE.grouP(1))
    y
 and only the ones after i t is desir ed.
F orexa mp le,youcan 

set a fl a g so  we know mid_pattern h as ma tc h ed
b r an ch ou t at th e  e n d _pa tt er n m at c hi ng
pa sse d_mid_p oint = Fal se.. .
if re.matc h (m iddle_patt ern , line):
   pa ssed_m id _po i nt =Tru e
   # dow hat yo u need
  . . .
if r e .match( e n d_ patt ern, line):
    p a ss e d_mid_point =False#s oy o u c anprocess ane w fra m e
    # do w h aty ou need after  end patter n  is  match ed 
 ...
el if pa ss e d_m id_point:
   #  parse th e coor d inates   term s = li ne. spl it()   ifte r msa nd  te r ms[ 1] == 'T ': 
      x= f l oat( ter ms[4 ])
       y = flo at( term s [5] )
      z =fl oat(t erms[6 ])

O r,  you can flag a nd m atch, som eth in g l ik e thi s :
   pas sed _mid_po int = F a lse 
co ord_patter = r'   \ d+  T '
  ...
  i fr e.match( mi ddl e_pa t t ern,line ) :       passed _ mi d_ point =  T rue
     #do wh a t yo u need 
      ...
  if re.match( e nd_pattern, l i ne ) : 
     p assed_mid_p oint = Fa lse#  s o y o u can  proc es s  a new frame
        #  d o what  youneed after en d patterni s matched    . ..
    if pass ed_mi d_point an d  re.matc h(coo rd_patte rn, line) :        # p ars e t hec o or dinates
     ter ms  = line .sp lit()
     if  te rm s and ter ms[1] ==  ' T' :        x = flo at (te rm s[4 ])
         y= fl oa t( t erm s[5])
     z= fl oat (t erms[ 6])The  coordi nate matc hin g  can  b edone fu lly in regula rexpression  a s w ell
sc i _ num = r' -?\d+\.\d*E[+\-]\d+'
co o rd_patt ern  = r' \s+\ d+\sT\s+\ d+\ s+[A-Z ]+\ s +(%s)\ s+(%s) \s+(% s) ' % ( sci_n u m ,sci _n um, sci_nu m ) 
co ord_r e= re .compil e(coord_pattern)
i f  co ord_re.match( lin e): x = fl o at( co o rd_ r e .group(1))
   y
 and_only the_ones after it is_desired.
For example,_you_can 

set_a_flag so we_know mid_pattern has_matched
branch out at the_end_pattern matching
passed_mid_point =_False
...
if_re.match(middle_pattern, line):
    passed_mid_point = True
    # do what_you_need
 __...
if_re.match(end_pattern, line):
   _passed_mid_point = False # so_you can_process a new frame
    #_do_what you need_after end pattern is matched
   ...
elif passed_mid_point:
_   # parse the_coordinates
  __terms_= line.split()
  _ if terms and terms[1] ==_'T':
     _  x = float(terms[4])
  _     y_= float(terms[5])
   _ _  z = float(terms[6])

Or,_you can flag_and match,_something like this:
_   passed_mid_point = False
_  _coord_patter = r'   __ \d+ T_'
__ ...
_  _if_re.match(middle_pattern, line):
__     _passed_mid_point_= True
     _  # do_what_you need
  _    ...
_   if re.match(end_pattern, line):
_ _ _   passed_mid_point = False # so you can process_a new frame
   _   _# do_what_you need after_end_pattern is_matched
      _...
 _  if passed_mid_point and re.match(coord_pattern,_line):
   __   # parse the_coordinates
     _  terms = line.split()
___    _if terms and terms[1] == 'T':
_  _      __x = float(terms[4])
   __     __y_= float(terms[5])
   _     _  z = float(terms[6])

The coordinate matching can be_done fully in_regular expression as well
sci_num =_r'-?\d+\.\d*E[+\-]\d+'
coord_pattern_=_r'\s+\d+\sT\s+\d+\s+[A-Z]+\s+(%s)\s+(%s)\s+(%s)' % (sci_num, sci_num, sci_num)
coord_re = re.compile(coord_pattern)
if coord_re.match(line):
  _ x_= float(coord_re.group(1))
 _  y