Question
sentence = 'we are humans'
matched = re.match(r'(.*) (.*?) (.*)', sentence)
print(matched.groups())
a.
(‘we’, ‘are’, ‘humans’)
b.
(we, are, humans)
c.
(‘we’, ‘humans’)
d.
‘we are humans’
Posted under Python
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. What is the output of the following?
Similar Questions
Discover Related MCQs
Q. The character Dot (that is, ‘.’) in the default mode, matches any character other than _____________
View solution
Q. The expression a{5} will match _____________ characters with the previous regular expression.
View solution
Q. ________ matches the start of the string.
________ matches the end of the string.
View solution
Q. Which of the following will result in an error?
View solution
Q. Choose the function whose output can be: <_sre.SRE_Match object; span=(4, 8), match='aaaa'>.
View solution
Q. Which of the following functions clears the regular expression cache?
View solution
Q. Which of the following functions results in case insensitive matching?
View solution
Q. The function of re.search is:
View solution
Q. Which of the following functions creates a Python object?
View solution
Q. Which of the following pattern matching modifiers permits whitespace and comments inside the regular expression:
View solution
Q. The function of re.match is:
View solution
Q. The special character \B matches the empty string, but only when it is:
View solution
Q. Which of the following special characters matches a pattern only at the end of the string?
View solution
Q. Which of the following functions returns a dictionary mapping group names to group numbers?
View solution
Q. Which of the following statements regarding the output of the function re.match is incorrect?
View solution
Q. To open a file c:\scores.txt for reading, we use
View solution
Q. To open a file c:\scores.txt for writing, we use
View solution
Q. To open a file c:\scores.txt for appending data, we use
View solution
Q. To read two characters from a file object infile, we use
View solution
Q. To read the entire remaining contents of the file as a string from a file object infile, we use
View solution
Suggested Topics
Are you eager to expand your knowledge beyond Python? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!