Naive vs Aware Datetime in Python

Naive vs Aware Datetime in Python

If I work with dates and times in Python, one of the first things I need to understand is the difference between naive and aware datetime objects. This is a small concept, but it prevents a lot of timezone bugs later. What is a naive datetime? A naive datetime is a datetime object that does not know which timezone … Read more >>

How to Convert Local Time to UTC in Python

Convert Local Time to UTC in Python

If I have a local time in Python and need the same moment in UTC, I convert it with astimezone(timezone.utc). In this tutorial, I’ll walk through the safest way to do it, why timezone-aware datetimes matter, and how I use this in real code. Why this matters I use UTC whenever I need a time value … Read more >>

How to Schedule Tasks Based on Current Time in Python

Schedule Tasks Based on Current Time in Python

If I need a Python script to run something at a specific time, I usually start with the current time, compare it with a target time, and then trigger the task when it matches. In this tutorial, I’ll show you how to do that with plain Python first, then with the schedule library for cleaner recurring jobs. … Read more >>

How to Install TensorFlow on Jupyter Notebook (Anaconda + VS Code)

Install TensorFlow on Jupyter Notebook

If you’ve ever typed import tensorflow as tf inside a Jupyter Notebook and got hit with a ModuleNotFoundError, you’re not alone. This is one of the most common frustrations for beginners getting into machine learning, and it almost always comes down to one thing: TensorFlow was installed in a different environment than the one Jupyter is using. In this … Read more >>

How to Get UTC Time in Python

Get UTC Time in Python

If I need the current UTC in Python, I use datetime.now(timezone.utc) first. It gives me a timezone-aware datetime, which is the safest choice for logs, APIs, databases, and scheduled jobs. What UTC means UTC stands for Coordinated Universal Time. It is the standard time reference I use when I want one consistent clock across servers, apps, and … Read more >>

How to Install Django in Python (Windows, Mac & Linux)

install Django

If you’ve been hearing about Django and want to start building web apps with Python, you’re in the right place. In this guide, I’ll walk you through how to install Django step-by-step — on Windows, Mac, or Linux — from scratch. I’ll also show you how to run your first Django project, install a specific … Read more >>

How to Get the Current Date and Time in Python

python datetime now

If you want the current date and time in Python, the simplest answer is datetime.now(). In this tutorial, I’ll show you the right way to get local time, UTC, and timezone-aware timestamps, along with the formatting and pitfalls you should know. Python datetime module Python gives you the datetime module in the standard library, so you do not … Read more >>

How to Iterate Through Tuples in Python (6 Methods with Examples)

loop through tuple python

Tuples are everywhere in Python: database query results, function return values, coordinate pairs, and configuration settings. And knowing the right way to loop through them can make your code cleaner, faster, and more Pythonic. To iterate through a tuple in Python, you can use a for loop, a while loop, enumerate(), zip(), list comprehension, or itertools.chain(), each suited for a different scenario. … 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.