views:

575

answers:

3
+3  Q: 

Python Cheatsheet

Is there any definitive cheatsheet available for Python (3.1 especially). I'm learning from a book but I keep forgetting the various methods explained for lists, dicts, strings etc..

I'd like a cheatsheet or a tutorial spanning a few pages that has object type definitions, list of expressions, list of methods available for each object type etc..basically something easy to refer than lookup a 1200 page book I'm reading.

Thanks.

+1  A: 

I like this one for python 2.6.

Charles E. Grant
+8  A: 
>>> help(obj)

and

>>> dir(obj)
rgr
Know it already, but being an 'absolute beginner', I need definitions and other lists too.
Nimbuz
You can use tab-completion to do `dir` for you automatically, which makes this much more practical. See http://docs.python.org/3.1/library/rlcompleter.html
bobince
+2  A: 

While bigger than a cheatsheet, Mark Lutz's Python Pocket Reference is small but thorough reference and has just been updated to include Python 3 features.

Otherwise, there is this PDF cheatsheet for Python 2.6. And all of the Python documentation is online and probably installed on your machine as part of the Python installation. For 3.1 on OS X, bookmark this URL in your browser:

file:///Library/Frameworks/Python.framework/Versions/3.1/Resources/English.lproj/Documentation/index.html
Ned Deily
"For 3.1 on OS X, try this link" << You forgot to link?
Nimbuz
Couldn't get it formatted properly at first!
Ned Deily
Pocket Reference is great, btw.
Nimbuz