I am trying to remove parentheses and the text that resides in these parentheses, as well as hyphen characters. Some string examples look like the following:
example = 'Year 1.2 Q4.1 (Section 1.5 Report (#222))'
example2 = 'Year 2-7 Q4.8 - Data markets and phases' ##there are two hyphens
I would like the results to be:
example = 'Year 1.2 Q4.1'
example2 = 'Year 2-7 Q4.8'
How can I remove text residing within or following parentheses and special characters? I could only find str.strip()
method. I am new to Python, so any feedback is greatly appreciated!