1
0
This commit is contained in:
Khan
2021-09-01 02:57:54 +05:00
parent 9df940f1fd
commit bf3c3712dd
222 changed files with 1007430 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
def is_leaf(element):
"""
Return True if the element is a leaf, False otherwise. The element is
considered a leaf if it is either NavigableString or the "br" tag
:param element: A BeautifulSoup tag or NavigableString
"""
name = getattr(element, 'name', None)
if not name or name == 'br':
return True
return False