I remember once hearing "No matter what you do for living, learn a programming language it will ease your life."

Although, using Linux takes you to a long trip of practicing scripting with bash, I was never really into programming (still not, eventhough I would have liked at some point).

From my school years, I think the first programming language I was in touch with was C++ in highschool.

Then at university, studying engineering, I was introduced to Java, since the professor was more into IT and front ends, for an engineering point of view was not really great. Also I hated the syntax of Java. It was just too confusing for me.

A couple of years later, learning numerical methods applied to engineering, long iterations to solve differential equations, I was introduced to Fortran. The syntax was simpler and easier to follow.

Finally I learned a bit of Matlab, you know for Lapace and all things I already forgot. I felt the syntax friendlier than Fortran and having several libraries to use I found it to be comfortable.

I never really used any of those languages outside school.

Then, somehow I heard about Python. The syntax was the cleanest I've ever found, the code looked very clean and easy to read. To me, it looked like and elegant programming language, but I never had the opportunity to learn it.

One day, having free time I decided to translate some of my Fortran code to Python, so I decided to take an online course from EdX that was called 'Mathematical Modelling basics', which was similar to what I used to do with Fortran. Following the course I was able to write the codes of the course and also translate my Fortran codes to Python. Still lacked the basics of Python since the course was very straight forward, but at least I learned a bit about the syntax.

I continued keeping an eye in Python and then I discovered the so many applications of Python, from data science to web development and even a Window Manager called Qtile and webbrowser called qutebrowser (based on PyQT5). I was overwhelmed…

Still I didn't enrolled to learn Python, I didn't know where to start, I started working, so free time was lacking and then in reddit I learned about Automate the Boring Stuff with Python.

Automate the Boring Stuff with Python

In Automate the Boring Stuff with Python, you'll learn how to use Python to write programs that do in minutes what would take you hours to do by hand - no prior programming experience required.

The course was created by Al Sweigart and it is free to read under a CC license.

It was a no brainier for me, it was covering what I was looking for: Basics of Python, examples, automating tasks, working with spreadsheets, web scraping and controlling the keyboard and mouse. Although it is free, you can still buy it's book to support it or take his Udemy course (which by the way, he sometimes gives free coupons to take the course for free in the Python or LearningPython subreddits, I don't really remember which one).

What was useful for me

Anyways, I completed the course not long ago and now I feel more confident with my Python programming skills. I have already wrote 5-6 scripts to automate tedious task at work like:

  • Extracting data from spreadsheets, get a summary and update the main spreadsheets (like databases) used by PowerBI for weekly and monthly reports. I used to spend about 30-60 minutes doing this, now the script takes like 5 seconds. The script makes use of os, shutil, openpyxl, for, if and while loops together with dictionaries. Now I am thinking about using pandas for this to reduce code lines, since the code contains around 200 lines including the dictionaries (which are not that long), but the loops reduce the readability of the code.
  • Uploading files using the webbrowser. I have to upload files to some webpages and these webpages do not allow bulk upload, so it is one by one. Somedays I have to upload 20-30 files per webpage, which is time consuming so I created a script that reads the files in a specific folder, store them in an list, identify screen webpage elements to allow the program to continue or wait until webpage loads correctly, compare the information displayed on screen with the one contained in the file, upload the file if it finds a match and continue with the next one. The script makes use of os, pyautogui, pyperclip and xml.etree.ElementTree. I would've loved to use selenium for this, but the webpage does not display the information as selenium reads, I don't know why, I need to investigate more.
  • Manipulate a company application to create orders, extract data and create entries. Some tasks, like creating entries, had to be repeated like 100 times. You can imagine the hassle. The script I created uses pyautogui and pyperclip.
  • Autologging to webpages and web scraping using selenium.

Some more.

  • Al Sweigart has more free books in his webpage from creating games to cryptography. Give it a look. I am very gratefull for his work.
  • Microsoft have developed Power Automate, which should be available in many companies. It is well integrated with the microsoft apps and really makes easy daily work routines like schedule meetings based on an email subject/content, save attachments from emails in specific folders. Even manipulate excel spreadsheets, word documents, webbrowsers (to do scraping) and more apps. You don't need to know anything about programming, everything is done by dropdown menus. It can also be integrated with AI. I've been using this as well to automate as many things as I can.
  • There is MicroPython which is dedicated for microcontrollers (e.g. ESP devices, arduino, raspberry pi). I haven't tried it, since I still prefer ESPHome or Tasmota for IoT devices just for simplicity and laziness.
1
2
3
farewell = {' Thanks ', ' for ', ' reading. '}
for word in farewell:
    print(f'{word:-^50}')
--------------------- Thanks ---------------------
---------------------- for -----------------------
-------------------- reading. --------------------
If you found this content useful, please support me:
BTC: 1E2YjL6ysiPxRF4AEdXChpzpesRuyzgE1y

Do not forget to share.