Fix the Python 3 Pickle TypeError

a bytes-like object is required not list

When I first started working with the Python pickle module in Python 3, I ran into a frustrating error: This error often happens when we try to use pickle in text mode instead of binary mode. It confused me at first, but after a few trials, I figured out the exact cause and how to … Read more >>

Python Program to Find the Last Day of a Month

Python program to get last day of month

Recently, I was working on a payroll automation project where I needed to calculate the last day of each month. The challenge was that months don’t all have the same number of days, and leap years add another layer of complexity. Since I’ve been coding in Python for more than a decade, I’ve run into … Read more >>

Check N-Digit Armstrong Numbers in Python

armstrong number in python

While I started teaching Python, one of the most common beginner questions I got was about Armstrong numbers. It’s a simple concept, but it’s also a great way to practice loops, conditionals, and functions in Python. In this tutorial, I’ll show you three different methods to check N-digit Armstrong numbers in Python. I’ll also provide … Read more >>

Declare a Variable Without Assigning a Value in Python

How to Declaring a Variable Without Assigning it a Value in Python

As a developer, I was working on a large data processing project for a client in California. I faced a situation where I needed to declare variables first and only assign values later in the program. If you have been coding in Python for a while, you know that, unlike some other programming languages (like … Read more >>

How to Print a New Line After a Variable in Python

python print new line

When I first started coding in Python more than a decade ago, one of the simplest things that tripped me up was printing text exactly the way I wanted. I often needed to display a variable on one line and then move directly to the next line for clarity. At first, I didn’t realize how … Read more >>

How to Get the First Character of a String in Python

Get the first characters of a string in Python

I was working on a project where I needed to quickly check the first letter of customer IDs stored in a database. At first, I thought there might be only one way to do this. But after experimenting, I realized Python offers several simple methods to extract the first character of a string. In this … Read more >>

Remove Brackets from Python Strings

How to remove brackets from Python string

Recently, while working on a data-cleaning project, I ran into a problem where my dataset had unnecessary square brackets around values. For example, instead of “New York”, the data looked like “[New York]”. If you’ve ever imported lists or JSON data into Python, you’ve probably seen this happen too. At first glance, it looks small, … Read more >>

Remove the First and Last Character from a String in Python

How to remove the first and last character of a string using Regular Expression in Python

While I was working on a project, I had to clean up messy text data coming from survey forms. Many responses had extra characters at the beginning and end, like brackets, quotes, or even unwanted symbols. At first, I thought Python would have a direct function for this. But just like in Excel, where you … Read more >>

Remove Quotes from a String in Python

How to remove quotes from a string in Python

As a Python developer, I was working on a data-cleaning project where I had to process large CSV files exported from a U.S. retail system. The issue was that many of the text fields came wrapped in single or double quotes. At first, I thought Python would have a built-in way to strip quotes from … Read more >>

How to Remove Unicode Characters in Python

python remove unicode characters from string

Recently, I was working on a data-cleaning project where I had to process customer feedback collected from different regions of the USA. The challenge? Many of the text files contained special Unicode characters like emojis, accented letters, and symbols that I didn’t need in my analysis. I quickly realized that removing Unicode characters in Python … Read more >>

51 Python Programs

51 PYTHON PROGRAMS PDF FREE

Download a FREE PDF (112 Pages) Containing 51 Useful Python Programs.

pyython developer roadmap

Aspiring to be a Python developer?

Download a FREE PDF on how to become a Python developer.

Let’s be friends

Be the first to know about sales and special discounts.