Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (47.6k points)

How to split this string where __ is the delimiter

MATCHES__STRING

To get an output of ['MATCHES', 'STRING']?

1 Answer

0 votes
by (106k points)

To split a string by a delimiter in Python you can use the str.split function string.split('__').

>>> "MATCHES__STRING".split("__") 

['MATCHES', 'STRING']

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Jul 18, 2019 in Java by tara92 (920 points)

Browse Categories

...