Chapter 2
Where Python Is Strong
Let Python Handle Repetitive Work
Have you ever finished a boring task and thought, “and I get to do all of this again next week”?
Perhaps you copy the same figures into a report every Friday. Maybe you rename photographs after every event, or check a stack of forms for the same missing field, or check that a website still works after every change.
That feeling is the best signal I know for where Python earns its keep. A computer will apply a clear rule ten thousand times without getting bored or careless. Which does not mean every repeated task should be automated, and most of this lesson is about telling the difference.
Somebody still has to decide the rule
Automation moves the work, not the judgment. Python does not look at your Friday and work out what you meant. Before a program can rename anything, a person has to decide what the new names should be.
Say you have a folder like this:
| Before | After |
|---|---|
IMG_8041.jpg | 2026-08-30_workshop_01.jpg |
IMG_8042.jpg | 2026-08-30_workshop_02.jpg |
IMG_8043.jpg | 2026-08-30_workshop_03.jpg |
Python will apply that pattern to three files or thirty thousand. But somebody had to supply the date, the event name, the order the photographs go in, and where they end up. Somebody also had to give the program permission to change the files at all.
I would want to see a preview before it touched anything. A computer repeats a correct rule very fast. It repeats a mistake at exactly the same speed.
What Python brings to it
The standard library covers a surprising amount of this on its own: files and folders, dates, text, CSV files, running other programs, checking that your own code still works. A CSV file is a plain-text table of rows and columns, the format spreadsheets offer when you ask for something every tool can open.
Where the standard library runs out, the ecosystem usually has the rest. Spreadsheets with their formatting intact, images, documents, company systems, websites.
So the language gives you a clear way to write the rule down, and the tools give you a way to reach the actual material. That combination is why this is the first place I look.
Walking one decision
Suppose that Friday report is the candidate. Here is what I would want to know before writing a line.
Does it genuinely repeat? Two minutes once a year is not worth a program. Two hours every Friday is worth a great deal of programming.
Can you say the rule out loud? “Put each report in the folder for its month” works, as long as every report reliably carries a date. “File it wherever makes sense” does not, because the sense is in your head. If you cannot explain the rule to a new colleague, you cannot explain it to Python either.
Can the program reach the information? It may sit in files, an email account, a website, or a system belonging to someone else. Being technically able to get into something is not the same as being allowed to.
Can you check the first run? Work on a copy. Show a preview. Compare against a result you already trust. Do this every time the rule changes, not only on the first run.
What happens when something is wrong? A missing date, a renamed column, a filename nobody expected. The good failure is a loud error. The expensive one is a program that carries on and quietly produces a wrong report every Friday for a year.
Two that come out differently
Check whether every form has a date. A strong candidate. The rule is completely unambiguous: the date is there or it is not. A person still decides what to do about the ones that fail.
Decide whether a customer’s complaint is fair. Not this. It needs context, judgment, and somebody willing to be accountable for how a person was treated. A program can gather the relevant history and hand it over. It should not reach the verdict.
The honest verdict
Python is a strong fit for repeated work on information when the rules are clear, the incoming data is reliable, and mistakes surface somewhere a person will see them.
It is workable with tradeoffs when it automates a safe portion and leaves the real decision with a human. And it is usually not the first choice for automating the whole of a task that turns on unclear judgment, changes shape constantly, needs access you should not hand out, or hurts somebody when the rule is wrong.
Automation can take a great deal of dull work off your week. It cannot take over understanding the work, and it is most dangerous when somebody hopes it will.
So far one program has done one job. Real products divide the work between several parts, and Python does not sit in all of them. Next we follow a single click through a website to find out which part is Python’s.
Go deeper
Python’s official guide to the standard library shows the range of tools that arrive with the language, and Python.org collects examples of Python applications. Both optional.