-
Notifications
You must be signed in to change notification settings - Fork 0
/
example_1.py
74 lines (44 loc) · 1.25 KB
/
example_1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import html_with_python as hwpy
# to convert html tags in python to html document
import pytoh
# creating html tag
# thtml object in terms of python
html_1 = hwpy.thtml();
# creating head tag
# thead object in terms of python
head_1 = hwpy.thead();
# creating body tag
# tbody object in terms of python
body_1 = hwpy.tbody();
# creating title tag
# ttitle in terms of python
title_1 = hwpy.ttitle();
title_1.content = "Webpage 1"
# creating div tags
# tdiv objects in terms of python
div1_1 = hwpy.tdiv();
div2_1 = hwpy.tdiv();
# creating p tag
# tp object in terms of python
p1_1 = hwpy.tp();
p1_1.content = "Hello here welcome to my webpage"
p1_1.id = "id1"
p1_1.classs = ["class1" , "class2"]
# creating p tag
# tp object in terms of python
p2_1 = hwpy.tp();
p2_1.content = "Are you ready to know about some villages?"
p2_1.id = "id2"
p2_1.classs = ["class3", "class2"]
# structre the tags
html_1.tappend(head_1)
html_1.tappend(body_1)
head_1.tappend(title_1)
body_1.tappend(div1_1)
body_1.tappend(div2_1)
div1_1.tappend(p1_1)
div2_1.tappend(p2_1)
# to covert html tags in python to html document.
# html document is created with the specified name.
html_str = pytoh.pytoh(html_1 ,"index.html" , htmlstr = True)
#print(f"html_str : \n{html_str}")