Ben Chuanlong Du's Blog

And let it direct your passion with reason.

Hands on dict in Python

Tips and Traps

  1. Starting from Python 3.7, dict preserves insertion order (i.e., dict is ordered). There is no need to use OrderedDict any more in Python 3.7+. However, set in Python is implemented as an unordered hashset and thus is neither ordered nor sorted. A trick to dedup an iterable values

Install Python in macOS

There are a few ways to install Python in Mac.

  1. Install system-wide via the official Python installation package.

  2. Install locally using Homebrew (recommended).

You should avoid installing multiple versions of Python in your system. It usually brings more troubles than conveniences. Python virtual environemnts ( via uv ) and Docker containers are …

My Docker Images

Most of my Docker images have different variants (corresponding to tags latest, next, etc) for different use cases. And each tag might have histocial versions with the pattern mmddhh (mm, dd and hh stand for the month, day and hour) for fallback if a tag …

Use pdftk to Manipulating PDF Files

  1. It is suggested that you use Python modules or Stirling-PDF instead of pdftk to manipulating PDFs for several reasons. First, even though pdftk is a great command-line tool, it is hard to remember its syntax. On the contratry, Python code is easy to read and understand (even though it is …

Editing PDF Files

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

Type Name Comments
Web Tools Stirling-PDF - robust
- local hosted
- Docker container based
Parseur - AI-based PDF parser
DocuSign - Great for convert PDF files to MS Office files …