data = """
<table>
    <tr>
        <td class='thisIsMyClass' colspan=4>
          <a id='123' class='thisIsMyOtherClass' href='123'>Put me Elsewhere</a>
        </td>
    </tr>
</table>
"""
replacement = """
<font SIZE="3"  COLOR="#333333"  FACE="Verdana"  STYLE="background-color:#ffffff;font-weight: bold;">
  <h2>{text}</h2>
</font>
"""
soup = BeautifulSoup(data, 'html.parser')
for td in soup.select('td.thisIsMyClass'):
    pass
Замена тегов одного вида на теги другого в BeautifulSoup