Python Scripting -a superpower for non-programmers.

5 min readMar 23, 2021
Photo by u/5ubv3rsion on Reddit

I admit it, programming languages have very weird names. A novice to computer programming might wonder how this programming language relates to snakes and pythons. The logo has an image of a python, after all — but no, there is no relation between the two. Guido van Rossum, the creator of the language was a big fan of Monty Python, a British comedy group and got his inspiration from them. Rossum’s love for Monty Python rolled over to his “hobby” programming project which later became the most beloved programming language of all time. It is now being used to create a variety of applications- from small scale to enterprise-grade. Now let’s get down to business. In this blog, I will introduce you to Python and Python scripting and will give you some ideas to use this superpower.

Introduction to Python

What Is Python?

Python is an interpreted, high-level and general-purpose programming language. If you do not know what these terms mean, don’t fret. We don’t need the definitions of these terms to use the superpower. You just need to download the programming language from the official website of Python. If you want to learn the programming language you can use the official documentation.

Why Python?

  • Python is very easy to get into and start coding. It has a syntax very similar to normal English.
  • A large number of communities and books are available to support Python developers.
  • Python is a general-purpose programming language. Hence it can be used to make a variety of applications.

Python is the one programming language to rule them all.

Photo by xkcd

Why Python Scripting?

Scripting is a code used to automate processes that would otherwise need to be executed step-by-step by a human. Scripting languages are used to give instructions to the computer to do the tasks for you.

When some task is monotonous and repeating in nature: Script it in Python.

Python scripting language is very powerful. It gives you the ability to control the OS functions, move, copy and delete files. Work with excel sheets a lot? Need to automate data entry? No worries, Python has got you covered. Need to send too many emails? Python will do it for you. You can automate almost everything using python. To begin python scripting, you can use IDLE- the default IDE which ships when you download the python package above, but I recommend that you download Visual Studio Code.

Python Scripts to Automate Tasks

Ideally, you should learn the syntax of the language to know what is going on behind the scenes in these scripts. But if you don’t want to, then you can use these scripts right away to begin automating your tasks by copying them in your IDE, saving it as and by just running the file. Your tasks are now automated!

Automate Updates in Excel Sheets

import openpyxl as xl
wb = xl.load_workbook('python-spreadsheet.xlsx')
sheet = wb['Sheet1']
for row in range(2, sheet.max_row + 1):
cell = sheet.cell(row, 3)
corrected_price = float(cell.value.replace('$','')) % 10
corrected_price_cell = sheet.cell(row, 4)
corrected_price_cell.value = corrected_price

Suppose you want to do an operation on one of the columns in your excel sheet consisting of a hundred rows, but if that operation is not supported in excel, you would need to manually update each row! This python script will do that task in no time.

Data entry is very monotonous

Sending Emails

import getpass                                                                                              import smtplib                                                                         HOST = “”                                                                                      PORT = 465 
username = “” password = getpass.getpass(“Enter your gmail password“)
server = smtplib.SMTP_SSL(HOST, PORT)
server.login(username, password) server.sendmail(“”, “”, “Hello There!”,)

This is the python snippet for sending an email. Substitute your email and password and change the variables suited to your needs. Run the program and you have just sent an email programmatically. The true power of this snippet will be realized when you use it inside a for loop iterating over the list of user email ids you want to send the email to.

Speech-based Diary

import speech_recognition as sr
r = sr.Recognizer()
with sr.Microphone() as source:
print("say something")
audio = r.listen(source)
print("Your text: "+r.recognize_google(audio))

Are you worried about your privacy when you write your daily deeds in a diary application? This python snippet will convert your speech to text and you can then store it locally on your computer, not worrying about privacy.

Real-life examples of Python Scripting

I can’t show you all the python scripts which will help you to automate your tasks , but I can list some of the cases where python scripting is actually being used to automate stuff. You can write your own scripts to automate these cases.

  • Routinely download files from a website
  • Share Prices Tracker / Notifier
  • Chatbot
  • Filling Online Forms

Ideas for automating tasks

There are still some tasks that I feel needs to be automated, but I couldn’t find any implementation on the Internet. These could be your next Python Project or my next Python Scripting Blog.

  • File Management- For example deleting the files from recycle bin periodically.
  • Reminders/Notifiers for social media- You can write a script that will inform you if your favourite social media influencer /page has posted something.
  • Automating your daily desktop routine- Checking your emails, messages and tasks assigned to you on Slack? You can write a script that will show you all of these things in one place.

With this, I would only give you one word of caution. The process of automating your time-consuming tasks consumes time too.

Number of words : 885