I have the following findall expression :
for r in p.findall('.//r'):
for a in r.findall('.//br'):
text+= " "
for c in r.findall('.//tab'):
text+= " "
And i want to add a space in the text variable if i come across the tag "br"
or "tab"
, but I want to use a single expression rather than 2 separate ones. something like:
for a in r.findall('.//br'|'.//tab'):
but this returns an unsupported operand type error.
TypeError: unsupported operand type(s) for |: 'str' and 'str'
What is the right syntax for this?
No comments:
Post a Comment