Answers for "python split by first match"

3

python split on first occurrence

str.split([sep[, maxsplit]])
s = "123mango abcd mango kiwi peach"
s.split("mango", 1)
['123', ' abcd mango kiwi peach']
>>> s.split("mango", 1)[1]
' abcd mango kiwi peach'
Posted by: Guest on February-03-2020
0

python split by first match

s.split('mango', 1)[1]
Posted by: Guest on May-21-2020

Python Answers by Framework

Browse Popular Code Answers by Language