How to interfere some text in a html link string in python
Question: In the company I am working they use the above command to construct a link
from a list of data we are holding on a map

    
    
    link=a % firstUpper(b)
    

which produces something like

    
    
    <a href="path/tomyhtml/foo.html">foo</a>
    

I would like to alter the link string and add a title attribute to it so it
becomes like

    
    
    <a href="path/tomyhtml/foo.html" title="Some cool title">foo</a>
    

my thought was to alter add the title in 3rd character which looks to be
"most" of the times a space, but in my mind is not the most elegant solution.


Answer: Using [BeautifulSoup](http://www.crummy.com/software/BeautifulSoup/):

    
    
    from BeautifulSoup import BeautifulSoup
    soup = BeautifulSoup('<a href="path/tomyhtml/foo.html">foo</a>')
    soup.a["title"] = "Some cool title"
    

