Skip Navigation

Find cheat sheets for every topic, or make your own to share with your friends.

All Added Bytes cheat sheets are available free at Cheatography!

Visit Cheatography »

Python Cheat Sheet

The Python Cheat Sheet, a quick reference guide for the Python programming language.

Overview

Python Cheat Sheet 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!

Downloads

Cheatography
A more recent (even better) version of this cheat sheet is available at Cheatography!

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.

sys Variables

Thumbnail highlighting sys variable section. Python has a variety of built-in variables which give information about the system on which it is running.

sys.argv

Thumbnail highlighting sys.argv. sys.argv contains command line arguments in a zero-based list.

os Variables

Thumbnail highlighting os variables. 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.

Methods

Thumbnail highlighting methods. 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

Thumbnail highlighting 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

Thumbnail highlighting 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.

Thanks

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!

Translations

Cheatography
A more recent (even better) version of this cheat sheet is available at Cheatography!

Related Cheat Sheets

Linux Command Line

Linux Command Line Cheat Sheet

The Linux Command Line Cheat Sheet, a quick reference guide for bash and other command line tools in Linux.

Subversion

Subversion Cheat Sheet

The Subversion Cheat Sheet, a quick reference guide for command line Subversion.

Regular Expressions (V2)

Regular Expressions Cheat Sheet (V2)

The second version of the Regular Expressions Cheat Sheet, a quick reference guide for regular expressions, including symbols, ranges, grouping, assertions and some sample patterns to get you started.


comments powered by Disqus