Import:: >>> from pyquery import PyQuery as pq Assume spaces normalization:: >>> pq('

').text() '' >>> print(pq('

- toto
- tata

').text()) toto tata Complex wrapping:: >>> d = pq('
youhou
') >>> s = d('span') >>> s is d False >>> s.wrap('
') [
] We get the original doc with new node:: >>> print(d)
youhou
Complex wrapAll:: >>> doc = pq('
Hey you !
') >>> s = doc('span') >>> s.wrapAll('
') [] >>> print(doc)
Hey you !