The skillsets of humans and computers overlap in a lot of key areas. We’re both thinking creatures, in that the main thing we do is take in information and mull it over. We’re also both language-oriented creatures, in that our worlds tend to revolve around sets of symbols we use to communicate and be communicated to. The similarities more or less end there, though surgically embedded microchips are becoming increasingly common.
As silly fleshy creatures, we can do a lot of things that computers aren’t terribly good at yet. Like exercise critical and contextual judgement in a rigorous way, or practice empathy. On the other hand, the consistency, accuracy, and rapid-fire speed of computers makes them excellent at doing things that we either can’t do, or would rather not do. Like the performance of repetitive, tedious tasks.
Humans don’t really like performing repetitive tasks. To an extent we find them soothing and relaxing. But in general, we tend to find them tedious and boring. We like to be challenged and rewarded, to do complex things that make us grow and develop in our skillsets. We don’t like to plug the same numbers over and over again into a spreadsheet, generally speaking.
This is one of the best examples of a lucrative co-working situation between humans and computers. Using a programming language like Python, we can automate the performance of repetitive tasks in an efficient and effective way.
Let’s run through the fundamentals of automation with Python programming language. Here’s what we’ll be covering:
- What is automation, what is Python, and how do they fit together?
- What are some examples of how Python can be used to automate tasks?
- What are some tools that can be used to automate tasks with Python?
Need to brush up on your Python skills before reading through?
What is Python Automation?
To start approaching automation with Python, you’ll have to understand two things first: what automation is, and what Python is. You might have some idea of what these names refer to, but it’s always good to brush up your knowledge with a more substantial definition.
Automation: a process in which a manually performed action is transformed into one that happens automatically.
The process of automating a task is one in which a framework is activated. This framework, for our purposes a programming script, makes it possible for the task to be performed autonomously, on its own, without user intervention.
Why would someone choose to automate a task? There are two main reasons.
- Automating a task means that it can run a lot quicker, most of the time.
- Automating a task means there’s less potential for mistakes, as the impact of human error is mitigated.
Python: a versatile programming language that’s relatively easy to learn and use, thanks to its resemblance to the English language and it’s open-source licensing.
Python has a friendly, approachable syntax that’s easy to read and understand relative to other programming languages. Plus, the fact that it’s open-source means that there’s a huge variety of tools, libraries, frameworks, and support available for it. This is why Python is one of the go-to programming languages for running simple automations.
Python Automation Ideas
There’s a huge range of tasks that you might opt to automate by writing a Python script. Python users can use their creativity to create innovative automated solutions for the repetitive tasks they encounter in their daily life.
To give you an idea of the breadth of how users utilize Python to automate tasks, here are some common ways that Python automation is used:
- Sending out, replying to, and sorting emails
- Filling out PDFs and Excel files
- Sending HTTP requests
- Converting image files
- Performing quick math equations
- Calculating exchange rates
- Scraping data from web pages and saving it in the harddrive
Nonetheless, Python can be used to automate a whole ton more. Think of the tasks you perform dozens of times a day: copy and pasting things from one document to another, multiplying numbers by 100, or whatever else. These tasks can be automated by Python; you just have to figure out what tools you’ll need, and how you can write and run the script.
Python Automation Tools
Because of its open source licensing, Python has an engaged, supportive developer community backing it up. This means that there’s a range of Python libraries, tools, and frameworks available to bolster your programming efforts. This is good news for those who just want to automate basic tasks as simply as possible.
There are a bunch of tools you can use to make your automation efforts simpler and more intuitive. Dive into internet research to see what exactly is available to help you with the task you’re trying to automate, or lean into one of the many Python community forums for help.
But for starters, let’s look at a few great tools that can help you with automation.
The smtplib library is a great resource that will help you automate your emails. It uses the Simple Mail Transfer Protocol, which can be integrated easily with most major email platforms, like Gmail.
Selenium is an open-source software tool that you can use to automate tests carried out in web browsers. This can test websites for bugs, site crashes, and related things. This can potentially save users tons of time, or save you from not realizing your website has gone offline.
Beautiful Soup is a humorously named Python library that can be used to pull data out of HTML and XML files. Instead of manually going through a ton of HTML files and manually looking for the information you need, you can use this library to save you time and labour.
Want to learn how to actually get down to the nitty gritty and start writing out scripts in Python?