1、ConfigParser 是用来读取配置文件的包。
cfg = ConfigParser()
cfg.read(ini_file)
cfg.items()
返回
list
,元素为
tuple
读取ini配置文件,处理数据,得到需要的格式{'os_username': limiaomiao02, 'os_password': Test@123}
![](https://img-blog.csdnimg.cn/ee5f4ab6ed814a71bde35de47c37fe69.png)
2、 python语法中, items用于字典, 作用是以列表返回可遍历的(key, value)的元组数组
3、 __file__ 是模块文件(即 .py 文件)的一个属性,返回当前模块文件所在的路径
os.path.dirname() 是 os 模块当中的一个函数,这个函数接收一个 path 路径对象,返回路径 path 的父目录名称。
4、ini文件:
parameters: 包含的最基本的“元素”, 有一个name和一个value
sections: parameters都是以sections为单位结合在一起的, 在section声明后的所有parameters都是属于该section。[section]
comments: 注释语句是以分号“;”开始的
items = conf.items(‘email_163’)
print(items) # list里面对象是元祖
5、打断点
6、HTMLParse主要是用来解析HTML文件
7、BeautifulSoup
![](https://img-blog.csdnimg.cn/c6021c94740e4ce79b3f15b5099a9046.png)
![](https://img-blog.csdnimg.cn/7669b767a28141458ca38ec0c6239466.png)
![](https://img-blog.csdnimg.cn/65f2afb6cbbf409bb47e045a73fcce9f.png)
8、构造请求时,payload是参数
![](https://img-blog.csdnimg.cn/803f054ea48a41738fda24f6c25041da.png)
9、random()
![](https://img-blog.csdnimg.cn/0fe92f1fb83e44b0acb5ad7da57ab09c.png)
![](https://img-blog.csdnimg.cn/5c0c13dc75ae4394a03afda0e5946fd4.png)
10、flask-db.column属性
![](https://img-blog.csdnimg.cn/56e786967a504781b541ae196d002467.png)
11、sqlachemy查询集转化字典或者json格式的方法
![](https://img-blog.csdnimg.cn/ed58eb0cd1cd409b8083b65896190c0c.png)
12、python 获取系统当前时间 datetime.datetime.now()
13、flask操作数据库
![](https://img-blog.csdnimg.cn/a63bd4ff4c4d43ee9d7dfc32273e1970.png)
![](https://img-blog.csdnimg.cn/6eb69c88ef1a4d77a00925651e80e733.png)
flask基础之ORM基本操作:
Flask基础05(ORM基本操作) - 简书
14、正则表达式re,findall用法
![](https://img-blog.csdnimg.cn/669a6f4f90c243d29d3f76823e49ccf1.png)
![](https://img-blog.csdnimg.cn/23a48e533f624c1b8893f2f7d8727754.png)
\d{4}-\d{1,2}-\d{1,2}
![](https://img-blog.csdnimg.cn/2e8d240c8d004d27b13bd214c1238f63.png)
15、flask中的response
![](https://img-blog.csdnimg.cn/1b59c25101fe4abe908b7769ba2d1504.png)
15、datetime.strptime
![](https://img-blog.csdnimg.cn/7ffc0c522aeb40f8996adecae1054f71.png)
16、fetchall( )用法
![](https://img-blog.csdnimg.cn/595b67b1a5bc433d8bb1bb5d3c1d8af1.png)
17、将python元组转化为字典
![](https://img-blog.csdnimg.cn/4028d18cf2144454962606f89b56d340.png)
18、request.args.get
当需要获取前端页面表单传过来的id值的时候,我们就需要用request.args.get
19、datetime.strftime()
![](https://img-blog.csdnimg.cn/8c2ef8d44d574d169045009a59f9fead.png)