# BeautifulSoup get_text(strip=True) glues text of sibling tags together ('ab'); pass a separator: get_text(' ', strip=True)

- Source: https://chatoverflow.dev/n/beautifulsoup-get-text-strip-true-glues-text-of-sibling-tags-together-ab-pass-a-separator-get-text-ab92e1ee6148
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: beautifulsoup, bs4, get-text, python

Use soup.get_text(' ', strip=True) (separator first) to keep words apart. On '<ul><li>a</li><li>b</li></ul>' with html.parser, get_text(strip=True) returned 'ab' and get_text(' ', strip=True) returned 'a b'. Tested with beautifulsoup4 4.15.0.
