Import a Class from Another File in Python

python import class from another file

When I first started working on larger Python projects, I realized that keeping all my code in a single file was messy and hard to maintain. As my applications grew, I needed a way to organize my code more effectively. That’s when I started splitting classes into separate files and importing them whenever needed. In … Read more >>

Django CRUD Application with MySQL Database

django crud builder

Recently, I worked on a project for a small business in the USA where they needed a web app to manage customer records. The requirement was simple: store customer details in a database, and allow staff to create, read, update, and delete (CRUD) records easily. I knew Django + MySQL would be the perfect stack … Read more >>

CRUD Applications with Django and PostgreSQL

django crud operations tutorial

As a developer, while working on a project for a client, I had to build a simple employee management system. The client wanted a web application where they could add new employees, view their details, update them, and delete records when needed. While this sounds like a common requirement, it is the foundation of most … Read more >>

Program to Convert Array to CSV in Python

array to csv python

I was working on a project where I had to export a dataset from Python into a CSV file so that my team could analyze it in Excel. The dataset was stored in arrays, and the challenge was to quickly and efficiently convert these arrays into a CSV format. If you have ever worked with … Read more >>

Create a Dictionary of Sets in Python

python dict set

I was working on a project where I needed to manage students and the courses they were enrolled in. I quickly realized that a dictionary of sets was the perfect data structure for this. Because a dictionary lets me map each student’s name to their courses, and sets ensure that no duplicate courses are stored. … Read more >>

Get or Reset Django Admin Password in Python

django default admin password

As a developer, while working on a Django project, I forgot the admin password. At first, I thought there would be a simple way to “see” the password, but I quickly realized that Django stores passwords in a hashed format for security. So, you can’t directly view the admin password. But the good news is, … Read more >>

Print Simple Diamond Pattern in Python

half diamond pattern in python

When I started learning Python, one of the first challenges I faced was printing patterns. At that time, I didn’t realize how useful these small exercises were in building problem-solving skills. It looks simple, but it teaches you how to work with loops, conditions, and spacing in Python. In this tutorial, I’ll show you exactly … Read more >>

How to Copy a Dictionary in Python?

python copy dictionary

When I first started working with Python dictionaries more than a decade ago, I often ran into a simple but frustrating problem: copying dictionaries. At first, I thought assigning one dictionary to another would give me a new copy. But I quickly learned that it only created a reference, not a true copy. This meant … Read more >>

Python String endswith() Method

python endswith

When I was working on a project, I needed to filter files in a directory based on their extensions. I had hundreds of files with different formats like .txt, .csv, .json, and .pdf. The challenge was to identify and process only specific file types efficiently. That’s when I discovered the power of Python’s endswith() method. … Read more >>

Python String isdecimal() Method

python isdecimal

As a developer, I was working on a financial data processing project, and I needed to validate user input for dollar amounts and percentages. The challenge was determining whether string inputs contained only decimal characters before converting them to numbers. That’s when I discovered the power of Python’s isdecimal() method. This built-in string method became … Read more >>