I’m sure you’ve heard of Python or at least coding. But what exactly is it and more importantly, what can you use it for? In this guide, I’ll teach you the absolute basics of Python, zero context necessary!
Python is a coding language. Code is what makes a computer run. A simple task you execute on your computer, say clicking on a link to open a webpage in a browser, runs hundreds or thousands of lines of code behind the scenes.
As you can see in the top left of the screenshot below, the header of BBC.com is stored in an element called h2.module_title.
Every element, or piece of this webpage is then loaded through code and presented to you in the form of pictures and links, or a Graphical User Interface, or GUI (pronounced gooey) which is your browser window.
Code is simply running applications without that GUI. Instead of you clicking on a link, you tell the application to “get” that link by running a text command.
Can you understand these lines of code?
URL = www.bbc.com
Page = Requests.get(URL)
Simple enough right? You equate URL to the website, and tell the program to get said URL, storing the page as Page. That’s it.
A coding language like Python enables anyone to write simple applications without extensive effort to design a user interface. While intimidating at first, the basics of code are simple enough to understand.
Python is simply a language for you to code in. Similar to languages learned by human beings, it is merely a unifying standard of communication that is understood around the world, or in this case, across computers. There are other languages such as Java, Kotlin, C, to name some others. The idea is, that code written in Python can then be run on any other computer which has Python installed.
What can you use Python for then?
Some uses for Python I’ve found are:
- Web scraping
Collecting data from webpages such as article titles, dates of publication or even taking screenshots of webpages. Paired with utilities like Task Scheduler or crontab, you can automate web scraping to run 24/7, tracking changes on sites.
2. Data analysis
You can easily automate the cleaning of data with a Python package called Pandas, for example removing leading spaces, adding columns to aid primary keys, adding source names and titles etc. All this without using Excel, which means you can wrangle large datasets without lag or crashes!
In my next article, I’ll explain more about how to set up Python and write your very own web scraper!