File tree Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -10,4 +10,5 @@ erl_crash.dump
10
10
** /__pycache__
11
11
12
12
1-基础 /wav文件处理 /输出
13
- 1-基础 /图片处理 /生成gif /* .gif
13
+ 1-基础 /图片处理 /生成gif /* .gif
14
+ 2.1-topic:数据处理 /HTML生成 /* .html
Original file line number Diff line number Diff line change
1
+ 目标:
2
+ - 生成语法正确的 HTML 源码文件
3
+ - 包含相应自动测试代码
4
+ - 可限定范围, 否则网页中包含所有支持的类型的界面元素
5
+ - 段落文本内容参考<狗屁不通>, 带结构的界面元素使用内置的中文内容
6
+ - 暂时不包含任何元素特性(attribute)
7
+ - 如需要标识符, 尽量使用中文(包括元素 id 等等)
Original file line number Diff line number Diff line change
1
+ # Python 3.7.3下测试通过
2
+ # 参考: https://stackoverflow.com/a/48817000/1536803
3
+ import sys
4
+ from xml .etree import ElementTree as 结构
5
+
6
+ 根 = 结构 .Element ('html' )
7
+ body = 结构 .Element ('body' )
8
+ 根 .append (body )
9
+ div = 结构 .Element ('div' )
10
+ body .append (div )
11
+ span = 结构 .Element ('span' )
12
+ div .append (span )
13
+ span .text = "待文本生成"
14
+
15
+ 结构 .ElementTree (根 ).write ('测1.html' , encoding = 'unicode' , method = 'html' )
You can’t perform that action at this time.
0 commit comments