I had a string which is stored in a variable myvar = "Rajasekar SP"
. I want to split it with delimiter like we do using explode
in PHP.
What is the equivalent in Python?
Choose one you need:
>>> s = "Rajasekar SP def"
>>> s.split(' ')
['Rajasekar', 'SP', '', 'def']
>>> s.split()
['Rajasekar', 'SP', 'def']
>>> s.partition(' ')
('Rajasekar', ' ', 'SP def')