Learning Python

886
10
08-29-2013 10:20 AM
RobertBorchert
Frequent Contributor III
Can anyone direct me to a good resource for learning to script with Python?  Especially as it relates to ArcGIS

I have experience in VB so the idea is not completely foreign to me
Tags (2)
0 Kudos
10 Replies
JoeFlannery
Occasional Contributor III
0 Kudos
JimCousins
MVP Regular Contributor
There is also a free ESRI web course "Using  Python in ArcGIS 10"
http://training.esri.com/gateway/index.cfm?fa=catalog.webCourseDetail&CourseID=1868
Regards,
Jim
0 Kudos
DanPatterson_Retired
MVP Emeritus
www.python.org as well as any book published by O'Reilly (check online) These don't relate to ArcGIS but will get you up to speed.  Also don't forget the code samples in the help files http://resources.arcgis.com/en/help/main/10.2/index.html
0 Kudos
RobertBorchert
Frequent Contributor III
Thanks, these are both great suggestions.  I am going to run the free course and see if my Supervisor will get the book ordered for me.
0 Kudos
RobertBorchert
Frequent Contributor III
I was just on the Python web site before replying.

I see I can download Python for free.  It may come in handy for things outside of the ESRI environment.  Is ESRI Python use compatible with the most recent release of Python.


www.python.org as well as any book published by O'Reilly (check online) These don't relate to ArcGIS but will get you up to speed.  Also don't forget the code samples in the help files http://resources.arcgis.com/en/help/main/10.2/index.html
0 Kudos
MaryM
by
Occasional Contributor
Google has a python course, very good.
https://developers.google.com/edu/python/
0 Kudos
MattSayler
Occasional Contributor II
I was just on the Python web site before replying.

I see I can download Python for free.  It may come in handy for things outside of the ESRI environment.  Is ESRI Python use compatible with the most recent release of Python.


It's not the most recent (python is up to 3.x, ArcGIS uses 2.6 or 2.7 depending on your version), but from the bits of gossip I've heard, 2.x will probably be around for a while. Other than installing to a non-standard location, and adding the arcpy site package, I don't think Esri makes any significant changes to the distribution.

You used to be able to install python before ArcGIS and then the ArcGIS installer could use the existing python install (still had to be correct version). I haven't run an install in a few versions, so I'm not sure if that's true anymore. I think arcpy requires specific versions of certain modules too, like numpy, so it may not be 100% cut and dry anymore.

But all and all Python has been pretty handy. It's kind of like the Swiss Army Knife of languages.
0 Kudos
RobertBorchert
Frequent Contributor III
I have ArcGIS 10.2 on my machine.  I just looked in the Start menu and it shows Python 2.7 is installed.

It's not the most recent (python is up to 3.x, ArcGIS uses 2.6 or 2.7 depending on your version), but from the bits of gossip I've heard, 2.x will probably be around for a while. Other than installing to a non-standard location, and adding the arcpy site package, I don't think Esri makes any significant changes to the distribution.

You used to be able to install python before ArcGIS and then the ArcGIS installer could use the existing python install (still had to be correct version). I haven't run an install in a few versions, so I'm not sure if that's true anymore. I think arcpy requires specific versions of certain modules too, like numpy, so it may not be 100% cut and dry anymore.

But all and all Python has been pretty handy. It's kind of like the Swiss Army Knife of languages.
0 Kudos
StacyRendall1
Occasional Contributor III
I have ArcGIS 10.2 on my machine.  I just looked in the Start menu and it shows Python 2.7 is installed.


I would strongly recommend not installing another Python. You are better to just use the ArcGIS Python as your default system Python - there are no real disadvantages to doing this. It has the advantage that you don't have clashes, installer mixups, etc.

This is particularly true now that ESRI have released 64-bit Background Geoprocessing, which gives you a default 64-bit Python (unfortunately you can't then delete the 32-bit Python...). Prior to this I had to run a separate Python just for dealing with large datasets (outside of Arc), now I can use the one Python for everything.

For use with ArcGIS there are practically no advantages to using Python 3, so you aren't missing out on anything.

Although, if you really want to practice for when ArcGIS does move to Python 3 you can emulate a lot of the behaviour with with import __future__, i.e. (ones less likely to be useful commented out...):
from __future__ import division, print_function #, unicode_literals, with_statement
0 Kudos