How to separate string using multiple delimeters in split () | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to separate string using multiple delimeters in split ()

https://code.sololearn.com/cuYKzS4WaOIT/?ref=app

19th Mar 2023, 7:29 AM
Saumya Mishra
Saumya Mishra - avatar
2 Answers
+ 9
Saumya Mishra , maybe you are looking for something like this: e="(2+100)" res = e.strip('()') print(res) we can use the string method strip(), that removes leading and trailing characters from a string.
19th Mar 2023, 7:47 AM
Lothar
Lothar - avatar
0
Or combine lstrip and rstrip
24th Mar 2023, 8:10 PM
William Mabotja
William Mabotja - avatar