Published: 09 Aug 2018 › Updated: 09 Aug 2018
PyH源码解析(2)
生成Tag对象的属性
用户代码如下所示:
>>> a=div(a1='a1')
>>> print(a)
<div a1="a1">
</div>
在内部实现上,Tag对象的属性存放在一个字典中,字典的名字是attr,原来的名字是attributes,我觉得太长了,修改了一下。核心函数如下:
#把字典变成字符串,形如:' a="a" b="b"'
#需要注意的是class需要换成cl
renderAttr(self)->str
Leave PyH源码解析(2) to:
Read more #cn posts
Best Posts From brysj22952
We have not curated any of brysj22952's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From brysj22952
- 我为什么想自己实现语法解析器
- PyH源码解析(6)——完结篇
- PyH源码解析(5)
- PyH源码解析(4)
- PyH源码解析(3)
- PyH源码解析(2)
- PyH源码解析(1)
- Python语言PyH模块生成HTML文档使用说明
- linux屏蔽ctrl+s键的方法
- LXML官方文档翻译
- 使用Flask和React构建博客系统(1)
- 解决网站开发中网页在手机上显示不全的问题
- 2018.6.25 My microblog 微博
- MyBrain项目(1)
- 2018.3.20 My microblog 微博
- click的命令自动补齐功能介绍
- python命令行神器click介绍
- Linux find命令使用心得(Linux find cmd use experience)
- Piston工具翻译-Steem网络的瑞士军刀(2)
- Piston工具翻译-Steem网络的瑞士军刀(1)