开发者

BeautifulSoup removes trailing whitespace?

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜