What will be the output of the following Python code? [code]re.split(r'\s+', 'Chrome is better than explorer', maxspilt=3)[/code]

What will be the output of the following Python code?
Code:
re.split(r'\s+', 'Chrome is better than explorer', maxspilt=3)
A. [‘Chrome’, ‘is’, ‘better’, ‘than’, ‘explorer’]
B. [‘Chrome’, ‘is’, ‘better’, ‘than explorer’]
C. (‘Chrome’, ‘is’, ‘better’, ‘than explorer’)
D. ‘Chrome is better’ ‘than explorer’
 
Answer: b
Explanation: The code shown above demonstrates the use of the function re.split, including the use of maxsplit. Since maxsplit is equal to 3, the output of the code shown above is:[‘Chrome’, ‘is’, ‘better’, ‘than explorer’]
 

Tìm kiếm

Back
Top