The Python cheat sheet is a one-page reference sheet for the Python programming language.
If you like the cheat sheets, and want to say thanks, please consider buying me something from my Amazon Wishlist. Thankyou very much to those who have already hunted it down and sent me something - I'm very grateful!
The Python Cheat Sheet is released under a Creative Commons License (Attribution, Non-Commercial, Share Alike).
Please note: If you wish to link to a cheat sheet from elsewhere, please link to this page so others find all available versions, the license and the description.
Python has a variety of built-in variables which give information about the system on which it is running.
sys.argv contains command line arguments in a zero-based list.
In a similar fashion to the "sys" variables, Python also has built in variables which give information about the operating system on which it is running. This section also lists the "registered" OS names.
Python, as you might expect, has a huge variety of standard methods for working with strings, lists, files and classes, and this section lists those with, where possible, compulsory arguments.
Indexes and Slices
Indexes and slices have been known to trip up plenty of new programmers, and occasionally experienced programmers new to Python. This section of the cheat sheet shows by example how indexes and slices work in Python.
Date and Time
These sections of the cheat sheet include the DateTime and Time methods, as well as the various Date Formatting options available for the strftime and strptime functions.
This is the second cheat sheet created with the involvement of the Cheat Sheets Google Group, and the first to include twitter (@CheatSheets). Many thanks to Charly Walther and Dan Horning for their suggestions and feedback. Finally, thanks also to the 1017 people who requested this cheat sheet!