[Python-ideas] HTML Wrapper
pythonchb at gmail.com
Fri Mar 15 01:20:22 EDT 2019
This is very much the kind of thing that would belong in a library.
There's probably more than one out there right now. In fact, way back when
I started learning Python (almost 20 yrs ago!)), there was such a lib -- I
think it was called HTMLgen. However, since then, most people have decided
that templating is the way to accomplish this -- write the html with bits
of code in in, and have it generate the final html. There are many template
engines for/with Python.
Having said that, I actually use an OO html generator as an assignment in
So you can write it yourself...
Using the approach in that assignment, you would write your example as:
selector = Selector(_class="eggs")
for i in range(3):
On Thu, Mar 14, 2019 at 3:43 PM Steven D'Aprano <steve at pearwood.info> wrote:
> Hi Vlad, and welcome!
> On Thu, Mar 14, 2019 at 10:00:03PM +0100, Vlad Tudorache wrote:
> > Hello,
> > I'd like to know if there is a basic HTML wrapper for Python, like
> > TextWrapper but allowing the generation of HTML from strings or iterables
> > of strings.
> This list is for proposing and discussing ideas for new syntax or
> functionality for the Python language, not for asking basic support
> Are you are proposing that Python gets a HTML wrapper?
> If so, it is up to you to do your research first, so that you know the
> answer to your question before you propose the idea. You should be able
> to tell us what options are available as language features or
> third-party libraries.
> If you don't know the answer, there are many places you can ask,
> starting with Google and other search engines:
> and others such as Reddit's /r/learnpython subreddit, Stackoverflow, the
> Python-List mailing list, the Python IRC channel, and more.
> If you still have a proposal after doing your research, we're happy to
> hear it.
> Python-ideas mailing list
> Python-ideas at python.org
> Code of Conduct: http://python.org/psf/codeofconduct/
Christopher Barker, PhD
Python Language Consulting
- Scientific Software Development
- Desktop GUI and Web Development
- wxPython, numpy, scipy, Cython
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas