Learn sys
The interpreter's own controls: arguments, streams, exit codes and runtime state
The sys module exposes the running Python interpreter: command-line arguments, the standard streams, exit codes, the module search path, version and platform data, and hooks for tracing, auditing and exceptions. Command-line tools, launchers, debuggers and profilers are built on it, and knowing it explains a lot about how Python itself runs your code.
Before you start
How deep do you want to go?
1. EssentialsRead and write simple code, do the everyday basics
2. PracticalUse it productively at work, with the usual idioms
3. AdvancedThe less common features, performance and trade-offs
4. ExpertInternals and the edge cases experts know