I have a sequence and a pattern with several brackets (only one level deep)
seq = "TTVGYDRTERDFSSADFTTVGYDRTERDFSSADFTTVGYDRTERDFSSADFTTVGYDRTERDFSSADF"
pattern = "(TT)V(GYD)"
Now I would like to match the pattern and get the beginning and end of the bracketed parts. so for this example something like:
[(0,2), (3,6), (17,19), (20, 23), (34,36), (37,40), (51,53), (54,57)]
I've played around with the re package and thought I almoust had it with the
[reo.group(1).start(), reo.group(1).end() for reo in re.finditer( pattern, sequence )]
but sadly the .group(1) returns only a string and not a "Match Object". Does anyone have a good idea how this could be accomplished?