Python 101

Python 101 – Assignment Expressions

Assignment expressions were added to Python in version 3.8. The general idea is that an assignment expression allows you to assign to variables within an expression. The syntax for doing this is: NAME := expr This operator has been called the “walrus operator”, although their real name is “assignment expression”. Interestingly, the CPython internals also …

Python 101 – Assignment Expressions Read More »

How to Send Emails with Python

Python provides a couple of really nice modules that you can use to craft emails with. They are the email and smtplib modules. Instead of going over various methods in these two modules, you’ll spend some time learning how to actually use these modules. Specifically, you’ll be covering the following: The basics of emailing How …

How to Send Emails with Python Read More »

Python 101: Exception Handling (Video)

In this video tutorial, you will learn how exception handling works in Python. Specifically, you will learn the following: Common exceptions Handling exceptions Raising exceptions Examining exception objects Using the finally statement Using the else statement If you prefer to read a tutorial, you might be interested in this: Python 101 – Exception Handling Want …

Python 101: Exception Handling (Video) Read More »

An Intro to Python Virtual Environments

Python has the concept of the virtual environments built-in to the language. A Python virtual environment is an environment where you can install 3rd party packages for testing without affecting the system Python installation. Each virtual environment has its own set of installed packages and, depending on the virtual environment and how it’s set up, …

An Intro to Python Virtual Environments Read More »

OpenPyXL – Working with Microsoft Excel Using Python

The business world uses Microsoft Office. Their spreadsheet software solution, Microsoft Excel, is especially popular. Excel is used to store tabular data, create reports, graph trends, and much more. Before diving into working with Excel with Python, let’s clarify some special terminology: Spreadsheet or Workbook – The file itself (.xls or .xlsx). Worksheet or Sheet …

OpenPyXL – Working with Microsoft Excel Using Python Read More »

Python 101: An Intro to Working with JSON

JavaScript Object Notation, more commonly known as JSON, is a lightweight data interchange format inspired by JavaScript object literal syntax. JSON is easy for humans to read and write. It is also easy for computers to parse and generate. JSON is used for storing and exchanging data in much the same way that XML is …

Python 101: An Intro to Working with JSON Read More »

Python 101 – Learning About Loops (Video)

In this tutorial, you will learn how to use for and while loops in Python. Specifically, you’ll learn how to: Create a for loop Loop over a string Loop over a dictionary Extract multiple values from a tuple Use enumerate with loops Create a while loop Breakout of a loop Use continue Use else with …

Python 101 – Learning About Loops (Video) Read More »