Python is an excellent tool for automating tasks for my job. Much of my path so far involved following tutorials, reading books, and making many, many mistakes along the way. In the early months, learning how to learn programming required as much effort as learning Python itself.
To help you get started with learning Python, here are some things I wish I had known about when I first started learning Python:
When starting out, simple text editing programs served me well enough, but using software tailored to programming needs make life that much easier. I experimented with a few options including TextMate and Sublime Text, but Visual Studio Code is a game-changer for me. I set up the Solarized Dark theme and I haven’t looked back since. VSC has great features out of the box, but you can also add free extensions in the marketplace to accomodate your needs further.
Python Standard Library
Don’t re-invent the wheel like I did. When first starting out, I did not realize the extent of functionality that was already included with your Python installation. Regardless of whether you need Python 2’s Standard Library or Python 3’s Standard Library, you will find wonderful tools for working with just about any scenario you can imagine. If there’s something you need to accomplish in Python, odds are there’s something in the standard library that can at least help with part of the task.
PEP8 Style Guide
“This probably works great for you, but it’s going to be indecipherable to everyone else.”
The first time I went to a Python study group I finally had the chance to show my work to someone else. The first impression was just that my code looked like a mess. Enter the PEP8 Style Guide. It was tedious, but I went through all of my code and tried to adhere to many of the recommendations found in PEP8. It was one of the best decisions I have made. Not only is my code easier for other people to read and understand, it’s easier for me to understand my own thinking when revisiting code I haven’t looked at after months have passed.
Projects / Practice
The best way to learn Python in my experience has been to build something. If you don’t have something in mind when you’re first starting, Codecademy and Automate the Boring Stuff with Python cover many of the basic concepts to get you started quickly. In addition to Python lessons, Codecademy also has a great introduction to using the command line, which is a great skill to have.
This was a lifesaver for me. Before I learned about version control I had folders full of files with names like “new.py,” “testnew.py,”,”testnew1.py,” and on and on. Making changes without completely breaking your code is a challenge when you’re starting out. Version control allows you to make changes without fear and revert back to a previous version of your work if you make mistakes. Spend some time on the Git page to learn the basic Git commands and utilize Bitbucket or Github for all of your projects.
Regardless of what you hope to learn with Python, these resources should help to get you on your way. The most important thing is to keep working, don’t get discouraged, and be willing to break things and make mistakes!