Python XMl Parser with BeautifulSoup. How do I remove tags?
Question: For a project I decided to make an app that helps people find friends on
Twitter.

I have been able to grab usernames from xml pages. So for example with my
current code I can get `<uri>http://twitter.com/username</uri>` from an XML
page, but I want to remove the `<uri>` and `</uri>` tags using [Beautiful
Soup](http://www.crummy.com/software/BeautifulSoup/).

Here is my current code:

    
    
    import urllib
    import BeautifulSoup
    
    doc = urllib.urlopen("http://search.twitter.com/search.atom?q=travel").read()
    
    soup = BeautifulStoneSoup(''.join(doc))
    data = soup.findAll("uri")
    


Answer: Don't use BeautifulSoup to parse twitter, use their
[API](https://dev.twitter.com/docs/api) (also don't use BeautifulSoup, use
[lxml](http://lxml.de/)). To answer your question:

    
    
    import urllib
    from BeautifulSoup import BeautifulSoup
    
    resp = urllib.urlopen("http://search.twitter.com/search.atom?q=travel")
    soup = BeautifulSoup(resp.read())
    for uri in soup.findAll('uri'):
        uri.extract()
    

