Python beautifulsoup trying to remove html tags 'span'
- by Michelle Jun Lee
I am trying to remove
[<span class="street-address">
510 E Airline Way
</span>]
and I have used this clean function to remove the one that is in between < >
def clean(val):
if type(val) is not StringType: val = str(val)
val = re.sub(r'<.*?>', '',val)
val = re.sub("\s+" , " ", val)
return val.strip()
and it produces [ 510 E Airline Way ]`
i am trying to add within "clean" function to remove the char '[' and ']' and basically i just want to get the "510 E Airline Way".
anyone has any clue what can i add to clean function?
thank you