Skip to content

am230/py2html

Repository files navigation

Writing XML with Pythonic code

image

image

Installation

$ pip install pytohtml

Example

image

QR-Code Generator Source Code.

image

Simple Chat Source Code.

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>

About

Write HTML with Pythonic Code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages