I have been trying to remove unnecessary parts of a scraped string and I'm having difficulty. I'm sure it's simple but I'm probably lacking the terminology to search for an effective solution.
I have all the information I need and am now trying to create a clean output. I am using this code...
for each in soup.findAll('div', attrs={'class': 'className'}):
print(each.text.split('\n'))
And the output, a mix of numbers and text with variable spaces, is similar to...
['', '', '', ' 1 ', ' Text Example', ' (4)']
What I need to produce is a list like...
['1', 'Text Example', '(4)']
Perhaps even removing the brackets "()" from the number 4.
Thanks.