from yattag import Doc doc, tag, text = Doc().tagtext() with tag('a', href='https://www.google.com'): doc.attr(title='Search Google') text('Google Search') print(doc.getvalue())
Google Search
from yattag import Doc doc, tag, text = Doc().tagtext() with tag('div'): tag.attr('class', 'row') with tag('p'): text('This is a paragraph inside a div tag.') print(doc.getvalue())
Package Library yattag is a third-party package/library for Python that needs to be installed separately. It can be installed using pip or easy_install.This is a paragraph inside a div tag.