Skip to content

Commit

Permalink
fix empty elem in get_elem_text (#197)
Browse files Browse the repository at this point in the history
  • Loading branch information
calmzealA authored and chyroc committed May 5, 2018
1 parent 8d83511 commit cfd3d39
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion wechatsogou/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ def get_elem_text(elem):
Returns:
elem中文字
"""
return ''.join([node.strip() for node in elem.itertext()])
if elem != '':
return ''.join([node.strip() for node in elem.itertext()])
else:
return ''


def get_first_of_element(element, sub, contype=None):
Expand Down

0 comments on commit cfd3d39

Please sign in to comment.