Examveda

What will be the output of the following Python code?
n = re.sub(r'\w+', 'Hello', 'Cats and dogs')

A. Hello
Hello
Hello

B. ‘Hello Hello Hello’

C. [‘Hello’, ‘Hello’, ‘Hello’]

D. (‘Hello’, ‘Hello’, ‘Hello’)

Answer: Option B


This Question Belongs to Python Program >> Regular Expressions In Python

Join The Discussion

Related Questions on Regular Expressions in Python