You just need to move your parenthesis
temp_ID.append((re.search(r'exon_number\s""(\d)""',k).group(1)))
But if you want to catch a double digit you can change it to
temp_ID.append((re.search(r'exon_number\s""(\d+)""',k).group(1)))
Edit: To clarify, each set of parens will be a group you can access afterward, and \d+
means it will match 1 or more digits