1.

Which of the following functions returns a dictionary mapping group names to group numbers?(a) re.compile.group(b) re.compile.groupindex(c) re.compile.index(d) re.compile.indexgroupI had been asked this question in exam.The question is from Regular Expressions topic in section Regular Expressions and Files of Python

Answer»

Correct answer is (b) re.compile.groupindex

Best explanation: The FUNCTION re.compile.groupindex RETURNS a dictionary MAPPING GROUP NAMES to group numbers.



Discussion

No Comment Found

Related InterviewSolutions