Beautifulsoup split text in tag by <br/>
问题 Is it possible to split a text from a tag by br tags? I have this tag contents: [u'+420 777 593 531', <br/>, u'+420 776 593 531', <br/>, u'+420 775 593 531'] And I want to get only numbers. Any advices? EDIT: [x for x in dt.find_next_sibling('dd').contents if x!=' <br/>'] Does not work at all. 回答1: You need to test for tags , which are modelled as Element instances. Element objects have a name attribute, while text elements don't (which are NavigableText instances): [x for x in dt.find_next