when I use BeautifulSoup to get the text from html, I find it will ignore multiple spaces. For the example below, there are 2 spaces between </seg> and <seg>, but output only have one space, and whatever how many spaces, it'll sill output one space.
import bs4
text = "<line><seg>aaa</seg> <seg>bbb</seg></line>"
soup = bs4.BeautifulSoup(text)
print(soup.text)
print(soup.find_all(text=True))
output is:
aaa bbb
['aaa', ' ', 'bbb']
but what I really want is:
aaa bbb
['aaa', ' ', 'bbb']
Any ideas?
or
if there is an equivalent way in javascript? to get text but ignore multiple spaces outside of tag