#NEWLINE# def letters_between( text , strl , strr ) : #NEWLINE# #INDENT# 'finds letters in text between strl and strr\n    returns list of tuples (string, pos of strl, and pos of strr)\n    ' #NEWLINE# mid = '' #NEWLINE# out = [ ] #NEWLINE# left = None #NEWLINE# for ( ii , letter ) in enumerate ( text ) : #NEWLINE# #INDENT# if ( letter == strl ) : #NEWLINE# #INDENT# left = ii #NEWLINE# if ( ( left == ( len ( text ) - 2 ) ) or ( left == ( len ( text ) - 3 ) ) ) : #NEWLINE# #INDENT# mid = text [ ( left + 1 ) : ] #NEWLINE# out . append ( ( mid , mid , ( len ( text ) - 1 ) ) ) #NEWLINE# left = None #NEWLINE# #UNINDENT# #UNINDENT# if ( ( left is not None ) and ( letter == strr ) ) : #NEWLINE# #INDENT# mid = text [ ( left + 1 ) : ii ] #NEWLINE# out . append ( ( mid , left , ii ) ) #NEWLINE# left = None #NEWLINE# #UNINDENT# #UNINDENT# return out