Apparently using Soup.text removes trailing whitespace for some reason. For example:
In [1]: from Beautiful开发者_如何学CSoup import BeautifulSoup as Soup
In [2]: print Soup('<a href=''>a </a>').text+ 'a'
aa
Is this intended behaviour and is there any way to stop it happening?
Edit: the desired output is
a a
Maybe it comes from the fact that trailing whitespaces are eliminated in HTML
精彩评论