What do you advise for a Beginner Python who want to learn how to write Python ?
What about The Python Tutorial — Python 2.7.9 documentation from python.org? I've been following along with the standard Python tutorial from the Python organization, and for a beginner Python scripter I think it helps tremendously.
I am aware of that site but it is a bit overwhelming for a beginner. Once a beginner understand how to use Python for ArcGIS then that site is a good for an advance Python lovers.
My introduction to Python was a course through the University of Michigan on Coursera: https://www.coursera.org/course/pythonlearn The instructor is fantastic and I thought it laid a very good foundation for me being new to Python. Definitely recommend it for those who want to get a great introduction to the language.
I'd also recommend this class. You can access the material direct from the instructor without using the Coursera platform: www.py4e.com I've been using this as a refresher. I like the order the material is presented in, it gets you in to programming without first learning the in and outs of all the data structures.
Codecademy is where I learned a few basics. Learn to code | Codecademy
I'm working through How To Think Like A Computer Scientist (interactive) and finding it very useful; lots of good exercises to reinforce what is taught. I'd also recommend Codecademy Python track.
I am almost a year past my first look at Python and I learned best through analyzing small, simple examples of things and toying with it myself. Once I had a feel for how the small pieces worked, I just kept putting them together into larger and larger projects. It helps to have specific problems to solve so you can work toward measurable goals as you learn.
I found that online resources like forums, blogs, and documentation were my guiding light. However, like most things on the internet, you have to be mindful of your source. There are a lot of ways to do things in Python but very few "best" ways. Try to find examples in official documentation, style guides, or from industry experts so you don't develop bad habits. Places like StackExchange are amazing for having lots of answers but they don't always demonstrate best practices.
Although I don't yet understand it completely, the Zen of Python is worth reading and rereading. Here is a big collection of do's and don'ts.
Finally, if you have searched and tinkered and still can't figure something out, don't be afraid to post on a forum for help/advice.
I second what Blake Terhune says. Don't get too hung up on reading the right book first. The reason there are so many books is that no one has written the "best" one yet! Well, actually, it is because Python is huge and people tend to write books focused on certain aspects of it rather than writing encyclopedias on it.
Just pick a book, read some, and start coding and continue to code regularly. If Python is your first computer language, it will seem hard at times because you haven't learn to think like a programmer yet. Once you develop the way of thinking, learning the syntax becomes relatively straightforward.
Read the PEP 8, and even Google, style guides. Revisit them from time to time. They will seem dry at first, and most of it won't sink in right away, but understanding the style of the language makes reading it much easier, which makes learning quicker when you aren't hung up on how something looks.
Solve problems, whether they are your problems or not. Solving a problem for someone else will likely teach you a lot that will help you solve your own problems down the road.
Dig into other people's solutions to really understand what it going on. There can be a lot of learning packed into 3 or 4 lines of code.
Revisit books every once in a while.
Have fun with it.
I suggest you Python for Beginners - Python Training Course - Udemy it's free if you download the app from app store and it's very interactive
I think everyone is right, there are many great Python texts, training material, and tutorials. I happen to have read Think Python: How to Think Like a Computer Scientist and I agree with Russell, it was a interactive and useful.
The way that I am learning is by using online resources "including Geonet" to solve every task I do in ArcGIS with python. So many things that i do i just do in the command line in ArcMap or Catalog. I have not used a book at all. I started by going through the examples on the www.python.org site and learning how things worked. I am about 3-4 months into python and I have built Python Tool boxes, complete workflow scripts, and use it pretty much daily to loop through processing files.
I thought about the book route, but that is static learning. Get engaged like you are now by using online resources.
I would have a look at the PyCharm Educational Edition. I use the full-fledged PyCharm for Python development and love it. I haven't tried the Educational Edition, but it looks like a nice tool for learning Python interactively.
I bought an O'Reilly python book and played with that for a while. The esri courses aren't bad but they are only going to get you so far as they focus on the arcpy sitepackage. I think you should get a foundation in python before moving on to the esri courses. Though honestly once you have even a basic foundation, esri's APIs are very simple to figure out on your own.
Thank you everyone. I think learning python is a challenge and is like a learning another language. . In my opnion, I would start using the book Programming ArcGIS 10.1 with Python is a good start and do small stuff first what what Blake T suggest and work your way up and keep looking for the sytnax on the internet.. . It really has helped me too.
Thanks all !
Obligatory wiki reminder: https://wiki.python.org/moin/BeginnersGuide
It depends a lot on your background and expertise. If you've never done any programming then diving straight into arcpy and python at the same time is going to be tough. I found the Esri training course excellent, but focussed very much on arcpy, leaving coding novices floundering.
The python.org documentation and training is very detailed, if dense. It's mostly useful to experienced programmers picking up another language.
The best resource I found was An Introduction to Python (Guido van Rossum, Python Software Foundation) which gives a very clear, logically-progressed and concise (digestible) presentation. It's also loaded with working code samples so you if have a hankering to implement a certain python object you can dive in at any point and start tinkering.
Honorable mention to Learn Python the Hard Way which is even more task focussed.
Naturally O'Reilly's Programming Python is almost the 'bible' and is very comprehensive, almost too comprehensive. It's just sooo massive, I never have time to sit down and work through an entire section. most of my work is task-based, so it's off to stackexchange etc, bang out a solution and onto the next.
If your Python-fu is already strong and you're focussing on arcpy, then go no further than ESRI Press' Python Scripting for ArcGIS, which is the primary tutorial reference for arcpy.
I also found this book to be a great introduction and reference for learning ArcPy as a complete beginner to programming:
Python Scripting for ArcGIS: Paul A. Zandbergen: 9781589482821: Amazon.com: Books
I tried learning plain Python and found it difficult to relate to in terms of GIS. I might not have been looking at a good source (it was a book out of the library, so I can't remember exactly what it was.)
I quite like the "Head First" series for beginning programmers, their python version is pretty good. Nice conversational style with multiple ways of teaching the same thing—along with excises to figure it out.
If you want a traditional book format, check it out: Head First Labs from O'Reilly Media, Inc. :: Head First Python
Retrieving data ...