parsed_pattern.pattern.groups = 1 AttributeError: can't set attribute

pyral17 Source

Here is my code

def convert_regexp_to_noncapturing_parsed(parsed_pattern):
        res_data = []
        for key, value in parsed_pattern.data:
            if key == sre_constants.SUBPATTERN:
                index, subpattern = value
                value = (None, convert_regexp_to_noncapturing_parsed(subpattern))
            elif key == sre_constants.GROUPREF:
                raise ValueError('Regular expressions with back-references are not supported: {0}'.format(pattern))
            res_data.append((key, value))
        parsed_pattern.data = res_data
        parsed_pattern.pattern.groups = 1
        parsed_pattern.pattern.groupdict = {}
        return parsed_pattern

here in line parsed_pattern.groups = 1 i'm getting a error

AttributeError: can't set attribute

I dont know whats wrong

pythondjango

Answers

comments powered by Disqus