Skip to content

Python

语法

  • 类的 __init__() 方法会返回 None 并且只能返回 None
  • with CLASS() [as VAR]: 这个语法中 VAR 会被定义,当离开 with 之后也会存在,类型为 CLASS;进入 with 会调用 CLASS.__enter__(),离开会调用 CLASS.__EXIT__()
  • print(CLASS) 时, __str__() 的优先级会比 __repr__() 高。

Certifi

certifi 是一个 Python 库,旨在为 Python 项目提供 Mozilla 维护的受信任根证书合集(CA Bundle),确保 HTTPS 网络请求的安全。如果使用 mitmproxy debug,可能需要 export SSL_CERT_FILE=~/.mitmproxy/mitmproxy-ca-cert.pem 来信任相关证书。