125 字
1 分钟
Python高级语法
lambda
匿名函数的语法,冒号前为参数,冒号后为返回值。
lambda x: x * x列表生成式
[x * x for x in range(1, 11)][x for x in range(1, 11) if x % 2 == 0]内置函数
数学运算
- abs
- round
- pow
- divmod
序列操作
- all
- any
- sorted
- reversed
对象操作
- hasattr
- getattr
- setattr
- isinstance
导入库
json
import jsonjson.dumps(data, ensure_ascii=False) # 编码,支持中文json.loads() # 解码datetime
from datetime import datetimeos
import os线程池使用
from concurrent.futures import ThreadPoolExecutor
with ThreadPoolExecutor(max_workers=5) as executor: executor.map(func, iterable)逆向常用
JavaScript Hook 调试:
Object.defineProperty(document, 'cookie', { set: function(a) { debugger }}) Python高级语法
https://210214.xyz/posts/python-advanced/