markup = '<a href="http://example.com/">\nI linked to <i>example.com</i>\n</a>'
soup = BeautifulSoup(markup)
soup.get_text()
u'\nI linked to example.com\n'
soup.i.get_text()
u'example.com'
>>> from bs4 import BeautifulSoup
>>> html = '<a href="http://example.com/">\nI linked to <i>example.com</i>\n</a>'
>>> root = BeautifulSoup(html, 'html.parser')
>>> root.get_text()
# '\nI linked to example.com\n'
>>> root.i.get_text()
# 'example.com'