HyperText with Python
Project description
Hyperscript
Hyperscript is a lightweight library that allows you to write HTML with Python. It is heavily inspired by HyperScript.
Example usage
>>> print(h("p", "Hello world!"))
<p>Hello world!</p>
Class and id selectors
>>> print(h("p.class1#id", "Hello world!"))
<p class="class1" id="id">Hello world!</p>
Style
>>> print(h("p", "Hello world!", {"style": {"color": "red"}}))
<p style="color: red">Hello world!</p>
Nesting elements
>>> print(h("div", h("p", "Hello world!")))
<div><p>Hello world!</p></div>
Properties
>>> print(h("a", {"href": "https://www.example.com"}, "link"))
<a href="https://www.example.com">link</a>
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
hyperscript-0.1.0.tar.gz
(7.0 kB
view hashes)
Built Distribution
Close
Hashes for hyperscript-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a755a3aa8a2fed1f622dfa72761de7bef2a27f907a1cc3cc4d847a8d9b8cee86 |
|
MD5 | 7832831a74f6fbc539512e51e4c71529 |
|
BLAKE2b-256 | 2bc195ece5d94ad8ae5bda0fd8fc30b56bcd28c9f13b9b7342b89e940b5ce78f |