BeginnersGuide/Examples

This wiki is in the process of being archived due to lack of usage and the resources necessary to serve it — predominately to bots, crawlers, and LLM companies. Edits are discouraged.
Pages are preserved as they were at the time of archival. For current information, please visit python.org.
If a change to this archive is absolutely needed, requests can be made via the infrastructure@python.org mailing list.

Python Examples and Sample Code

When you're learning, small examples can be very helpful.

  • The Python Standard Library (archived copy), an electronically published book by Fredrik Lundh, examines most of the modules in Python's standard library, describing what the module does and giving a short example of its use. Note that this book is now relatively old and so misses a lot of the developments of the last two decades.

  • The Python Recipes, from ActiveState, is a very large collection of code snippets, some elementary and some advanced.