+ 3

How to define a function that...?

Hey friends ! i want to make this function which takes a string as input & if there's parenthesis in the string ,it deletes them with their content. Just like this : input=This is a (sample) text with an expression (in parenthesis). output=This is a text with an expression. . . . Will anyone help me, plz? Already thx -_*

13th Dec 2017, 7:36 PM
Ali
Ali - avatar
4 Answers
14th Dec 2017, 7:31 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 6
You can use the re module for that. Manipulating regex is tricky but gets the job done quite nicely: https://code.sololearn.com/cqV91JVdKQ5H/?ref=app
13th Dec 2017, 9:45 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 2
Thx a lot. what if we didn't use module ?
14th Dec 2017, 3:51 AM
Ali
Ali - avatar