F
F
freear2020-09-16 17:03:23
Python
freear, 2020-09-16 17:03:23

How to remove tags from text that has been parsed?

I am writing a parser, one section consists of blocks, they are parsed, but there is a . I can't remove these tags, replace doesn't help, what can I do? Here is the code:<р> </р>

def get_content(text: str):
    soup = bs4.BeautifulSoup(text, 'lxml')
    items = soup.find_all('div', itemtype="http://schema.org/Product")
    things = []
    for item in items:
                 try:
            discr = item.find('div', id='full_description').findAll('p')[:-1]
        except:
            discr = ''
            for i in discr:
                discr += i

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2020-09-16
@Tomio

Like this

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question