Ben Chuanlong Du's Blog

It is never too late to learn.

Hands on the json Module in Python

Tips and Traps

  1. It is suggested that you avoid using JSON for serializing and deserializing data. Please refer to Shotcomes of JSON for detailed discussions on this. TOML and YAML are better text-based alternatives to JSON. If serialization and deserialization is done in Python only, pickle

Hands on SQLite3

Tips and Traps

  1. Do NOT use SQLite3 on network filesystems (NFS, SAMBA, etc).

  2. .schema show create statement of a table

  3. You can force query to keep the original order of rows by applying order by rowid.

  4. SQLite3 supports full-text search by the FTS5 extension (since 3.9.0). It is suggested that you use the porter

Hands on the requests Module in Python

Comments

  1. It is suggested that you use the requests module instead of urllib unless you want to have minimal 3rd-party dependencies.

  2. Response.raise_for_status is a convenient method for raising an exception corresponding to the HTTP status code.