What will be the output of the following Python code? [code]re.split('mum', 'mumbai*', 1)[/code]

What will be the output of the following Python code?
Code:
re.split('mum', 'mumbai*', 1)
A. Error
B. [”, ‘bai*’]
C. [”, ‘bai’]
D. [‘bai*’]
 
Answer: b
Explanation: The code shown above splits the string based on the pattern given as an argument. Hence the output of the code is: [”, ‘bai*’].
 

Tìm kiếm

Back
Top