Write HTML with Pythonic Code
Project description
Installation
$ pip install pytohtml
Example
Syntax
from py2html.elements import html, head, body, meta, title, h1
print(
html(lang="en")[
head[
meta(charset="UTF-8"),
meta({"http-equiv": "X-UA-Compatible", "content": "IE=edge"}),
meta(name="viewport", content="width=device-width, initial-scale=1.0"),
title["py2html"]
],
body[
h1[
"Hello, Py2HTML!"
]
]
].render()
)
*formatted output
<html lang="en">
<head>
<meta charset="UTF-8"></meta>
<meta http-equiv="X-UA-Compatible" content="IE=edge"></meta>
<meta name="viewport" content="width=device-width, initial-scale=1.0"></meta>
<title>py2html</title>
</head>
<body>
<h1>Hello, Py2HTML!</h1>
</body>
</html>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pytohtml-1.2.6.tar.gz
(59.1 kB
view details)
File details
Details for the file pytohtml-1.2.6.tar.gz
.
File metadata
- Download URL: pytohtml-1.2.6.tar.gz
- Upload date:
- Size: 59.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32776b1312f2bb9aaf75fbb6b20aa1bb0428b8a8accbbdb9c3ed355fe74b0b71 |
|
MD5 | cb123df2ec3440e15b5f57246f2ff808 |
|
BLAKE2b-256 | b752805f7d776ecf4355fd4ad5b4474dd07c1b9c0afa2f797006d2fb4a8f9be5 |