How to use the pyquery.text.extract_text function in pyquery

To help you get started, we’ve selected a few pyquery examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gawel / pyquery / pyquery / pyquery.py View on Github external
Set the text value::

            >>> doc.text('Youhou !')
            [<div>]
            &gt;&gt;&gt; print(doc)
            <div>Youhou !</div>

        """

        if value is no_default:
            if not self:
                return ''
            return ' '.join(
                self._copy(tag).html() if tag.tag == 'textarea' else
                extract_text(tag, **kwargs) for tag in self
            )

        for tag in self:
            for child in tag.getchildren():
                tag.remove(child)
            tag.text = value
        return self
</div>