Write html to a file like object, using a pythonic syntax.
Project description
htmlwrite is a python library for writing html to a file like object, using a pythonic syntax. Use as an alternative to templating engines.
>>> import sys >>> >>> from htmlwrite import Writer, Tag >>> >>> writer = Writer(sys.stdout) >>> w = writer.write >>> c = writer.context >>> >>> with c(Tag('html')): ... with c(Tag('body')): ... with c(Tag('div', class_=('foo', ), s_font_weight='bold')): ... w('Hello world ') ... w(Tag('div'), 'ok, bye.') ... <html> <body> <div class="foo" style="font-weight: bold;"> Hello world </div> <div>ok, bye.</div> </body> </html>
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
htmlwrite-0.7.0.tar.gz
(6.6 kB
view details)
File details
Details for the file htmlwrite-0.7.0.tar.gz
.
File metadata
- Download URL: htmlwrite-0.7.0.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1241542aac4a515daf88aba86d46482edd0a8b1e736e20fc90afd88a722797e2 |
|
MD5 | a04ebdab6aaf059fdb5920dbc41b128d |
|
BLAKE2b-256 | 9335142543f5cf7d705e6c725fd9d2f91ab5c3702e4df65d0a3a2795bc4d2c30 |