Best Resources for Learning Python

1143
10
11-23-2010 12:29 PM
RichardFairhurst
MVP Honored Contributor
I was waiting for the Python forum to appear to start this post.  I would like to know what resources users of Python think are the best to learn what Python can do, both online and publications.

I don't particularly care for the style of help at Python.org, since I find that it uses too much Python specific jargon and provides too few examples that illustrate how to use the code (probably great for developers of the Python code base, but not necessarily for end users like me).  I like code examples, because they are easy to rip off to get started on my own ideas and also help me understand how to connect things together better.

So where is the best place to go looking for that kind of help?  The forums (and hopefully specifically this forum) will probably be the best for ArcGIS specific Python coding, but until this forum gets fully up to speed are there links to the best ESRI help topics on Python or previous Forum discussions on Python that are noteworthy for giving good advice on Python coding practices?  Thanks for your suggestions.
Tags (2)
0 Kudos
10 Replies
DonovanCameron
Occasional Contributor II
I like Python In A Nutshell (not sure about the current edition but author is O'Reilly).
It provides several examples, and it used to be a free downloadable e-book.

But I am just learning python so I start with Google and filter to show only the links that contain *edu* in their name.
They are often PDF tutorials with regards to specific GIS tasks.

I recently also got a great series of video tutorials for the very beginner, when I get home, I will find the link to post here. But these relate to python in general, not specific to GIS. These are helping me learn the jargon.
0 Kudos
DanPatterson_Retired
MVP Emeritus
start here
http://resources.arcgis.com/gallery/file/geoprocessing
download every toolbox/document/presentation that is associated with python, open them up and learn  Also, the online help files are generally pretty good once you get a sense of what is going on.
0 Kudos
ChrisSnyder
Regular Contributor III
Its pretty dated, but this ESRI .pdf got me started: http://gisgeek.pdx.edu/programming/Writing_Geoprocessing_Scripts.pdf (this is actually an ESRI document that is on their "Library" DVD, not sure why it's not posted on their website..). I'm sure there's a newer one that shipped with v10.

Also, the ESRI 2 day "intro to geoprocessing scripting" class was very usefull I have to say.

Seems that a lot of universities have put this sort of stuff together for into ArcGIS/Python classes: http://bss.sfsu.edu/jdavis/cert/9021/Ex3-PythonExer.pdf
0 Kudos
ChrisMathers
Occasional Contributor III
I have Leaning Python by O'Reilly. The 4th Edition covers Python 2.6 and 3.0. ArcGIS v10 uses 2.6. Also, #Python on irc.freenode.net is a great resource as well. Dont be daunted by the stuff they talk about. I ask noobish things all the time and they always take time to answer me. I agree that a class is good though. I got a class on a dvd from Keck and Wood for like 100 bucks thats a good intro to python for ArcGIS.

EDIT: Also, all good python skill starts with a viewing of Monty Python's Quest for the Holy Grail. It puts you in the proper mind set.
0 Kudos
FrankPerks
New Contributor II
If you just started to want to learn python, don't use ESRI's tutorials. They do alot of ... questionable things and alot of things that are only specific to their library. Also be extremly weary of ripping off python examples from ESRI's library certain parts of it are meant for previous versions.

I also really suggest you actually try and learn how to code, so this doesn't appear "I COPIED SCRIPT X AND SCRIPT Y AND PUT THEM TOGTHER NOW THEY DON"T WORK, HALP"

For learning Python:

1. Get Pyscripter (http://code.google.com/p/pyscripter/), run as fast as you possibly can from IDLE and notepad.
2. Read python's offical tutorial: http://docs.python.org/release/2.6.6/tutorial/index.html , they will hold your hand
3. Dive Into Python(http://diveintopython.org/) is free, and is one of the most commonly recommended tutorials

Things you should bookmark:

Stackoverflow.com: If you have questions about how to do x, post it there. You'll get a response within 5 minutes.

Python Library: http://docs.python.org/release/2.6.6/library/index.html keep this under your pillow for looking up specific functionality.

Google's Style Documentation(http://google-styleguide.googlecode.com/svn/trunk/pyguide.html) they have  very good points, and if you post on stackoverflow.com or other python  centric forums, and your code is not formatted atleast sanely they will  ridicule you.

For ArcGIS:

1. http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/What_is_ArcPy/000v000000v7000000/ ArcPy Library
2. Geoprocessing forum: http://forums.arcgis.com/forums/31-Geoprocessing
0 Kudos
ChrisSnyder
Regular Contributor III
If you have $$$ and a bunch of interested people:

http://learning-python.com/
0 Kudos
MikeHunter
Occasional Contributor
I know what you mean about the Python.org documentation--it's really good, but thick and lacking in examples.  When I was first learning Python, this site was really helpful:

http://effbot.org/zone/

Every topic is full of example code.   Be aware, though, that some of the samples are a little out-of-date, like for instance the references to the string module, which has been largely replaced by string methods.

good luck,

Mike
0 Kudos
FrankPerks
New Contributor II
Well, take them with a grain of salt - they are not the primary spot for learning python-real python.
Thanks for that, what is your opinion of PythonWin? http://www.python.org/download/windows/


Pythonwin has amazing intellisense. However it kinda stops being useful once you move outside of a single python file. When working on a package, things start to get fairly complex and at that point pythonwin stops being useful.


Lastly, go to the PyCom conference website.  All you ever want to know about advanced Python is there with some excellent presentations.

http://us.pycon.org/2010/conference/schedule/


Those presentations are great, however i just wish some of the presentations actually gave out the slides and not just a 45 minute video demo.

I know what you mean about the Python.org  documentation--it's really good, but thick and lacking in examples.   When I was first learning Python, this site was really helpful:

http://effbot.org/zone/

Every topic is full of example code.   Be aware, though, that some of  the samples are a little out-of-date, like for instance the references  to the string module, which has been largely replaced by string methods.

good luck,

Mike


Also watch out alot of the stuff on effbot, uses non standard modules or has been added to the python standard library under a slightly different name.
0 Kudos
ChrisMathers
Occasional Contributor III
I dont like pythonwin. I find the GUI a bit irriatating for some reason. I use Komodo now. You can have multiple scripts open in tabs. Handy if you are working on a few things at the same time.
0 Kudos