1. In a match found by a defined pattern, how to group various portions of a match?
Answer:
2. Which of the following methods of a match object, mo, is used to view the named group portions of match in the form of a dictionary?
- mo.dict()
- mo.gdict()
- mo.group()
- mo.groupdict()
Answer:
- mo.groupdict()
3. Which of the following syntax is used to name a grouped portion of a match?
Answer:
1. ?P<group_name>
4. What is the output of the expression
re.split(r'[aeiou]', 'abcdefghij')
?Answer:
1. ['', 'bcd', 'fgh', 'j']
5. Which of the following modules support regular expressions in Python?
Answer:::,ddsdsdmd:xcxvc
1. re
6. Which of the following expression is used to compile the pattern
p
?Answer:
1. re.compile(p)
7. What does the
search
method of re
module do?Answer:
2. It matches the pattern at any position of the string.
8. Which of the following methods of a match object
mo
is used to view the grouped portions of match in the form of a tuple?Answer:
3. mo.groups()
9. What does
seek
method of a file object do?Answer:
4. Moves the current file position to a different location at a defined offset.
10. What does the
match
method of re
module do?Answer:
4. It matches a pattern at the start of the string
No comments:
Post a Comment
If you have any doubts, Please let us know.