adplus-dvertising
frame-decoration

Question

What is the output of the line of code shown below?
re.split('\W+', 'Hello, hello, hello.')

a.

[‘Hello’, ‘hello’, ‘hello.’]

b.

[‘Hello, ‘hello’, ‘hello’]

c.

[‘Hello’, ‘hello’, ‘hello’, ‘.’]

d.

[‘Hello’, ‘hello’, ‘hello’, ”]

Posted under Python

Answer: (d).[‘Hello’, ‘hello’, ‘hello’, ”]

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 line of code shown below?

Similar Questions

Discover Related MCQs

Q. Choose the function whose output can be: <_sre.SRE_Match object; span=(4, 8), match='aaaa'>.

Q. Which of the following functions clears the regular expression cache?

Q. Which of the following functions results in case insensitive matching?

Q. The function of re.search is:

Q. Which of the following functions creates a Python object?

Q. Which of the following pattern matching modifiers permits whitespace and comments inside the regular expression:

Q. The function of re.match is:

Q. The special character \B matches the empty string, but only when it is:

Q. Which of the following special characters matches a pattern only at the end of the string?

Q. Which of the following functions returns a dictionary mapping group names to group numbers?

Q. Which of the following statements regarding the output of the function re.match is incorrect?

Q. To open a file c:\scores.txt for reading, we use

Q. To open a file c:\scores.txt for writing, we use

Q. To open a file c:\scores.txt for appending data, we use

Q. To read two characters from a file object infile, we use

Q. To read the entire remaining contents of the file as a string from a file object infile, we use

Q. To read the next line of the file from a file object infile, we use

Q. To read the remaining lines of the file from a file object infile, we use

Q. The readlines() method returns

Q. Which are the two built-in functions to read a line of text from standard input, which by default comes from the keyboard?