Articles on Trending Technologies

Technical articles with clear explanations and examples

Python program to find difference between current time and given time

AmitDiwan
AmitDiwan
Updated on 25-Mar-2026 580 Views

When working with time calculations in Python, you often need to find the difference between the current time and a given time. This can be accomplished using Python's built-in datetime module, which provides powerful time manipulation capabilities. Method 1: Using datetime Module The most reliable approach uses Python's datetime module to get the current time and calculate differences ? from datetime import datetime, time def time_difference_from_now(target_hour, target_minute): # Get current time now = datetime.now() current_time = now.time() ...

Read More

Find yesterday's, today's and tomorrow's date in Python

AmitDiwan
AmitDiwan
Updated on 25-Mar-2026 707 Views

When working with dates in Python, you often need to find yesterday's, today's, and tomorrow's dates. Python's datetime module provides the timedelta class to easily calculate dates relative to the current date. Basic Date Calculation Here's how to find yesterday, today, and tomorrow using datetime.now() and timedelta ? from datetime import datetime, timedelta present = datetime.now() yesterday = present - timedelta(1) tomorrow = present + timedelta(1) print("Yesterday was :") print(yesterday.strftime('%d-%m-%Y')) print("Today is :") print(present.strftime('%d-%m-%Y')) print("Tomorrow would be :") print(tomorrow.strftime('%d-%m-%Y')) Yesterday was : 05-04-2021 Today is : 06-04-2021 Tomorrow would be : ...

Read More

Python Program to print the pattern 'G'

AmitDiwan
AmitDiwan
Updated on 25-Mar-2026 673 Views

When it is required to print the pattern of the letter 'G' using '*', a method can be defined, and nested loops can be used to iterate through the numbers and print '*' to form a 'G' pattern. Below is a demonstration of the same − Example def display_pattern(my_line): my_pattern = "" for i in range(0, my_line): for j in range(0, my_line): if ((j == 1 and i ...

Read More

Python Program to Display Fibonacci Sequence Using Recursion

AmitDiwan
AmitDiwan
Updated on 25-Mar-2026 614 Views

The Fibonacci sequence is a series where each number is the sum of the two preceding numbers, starting from 0 and 1. We can generate this sequence using recursion, where a function calls itself until it reaches a base case. Fibonacci Recursion Logic The recursive approach works by breaking down the problem: Base case: If n ≤ 1, return n Recursive case: Return fibonacci(n-1) + fibonacci(n-2) Example def fibonacci_recursion(n): if n

Read More

How to use Boto3 to stop a crawler in AWS Glue Data Catalog

Ashish Anand
Ashish Anand
Updated on 25-Mar-2026 435 Views

In this article, we will see how a user can stop a crawler present in an AWS Glue Data Catalog using the Boto3 library in Python. Problem Statement Use the boto3 library in Python to stop a running crawler in AWS Glue Data Catalog. Approach to Solve This Problem Step 1: Import boto3 and botocore exceptions to handle exceptions. Step 2: Define a function that takes crawler_name as a parameter. Step 3: Create an AWS session using boto3. Make sure region_name is mentioned in the default ...

Read More

How to use Boto3 to stop a workflow in AWS Glue Data Catalog

Ashish Anand
Ashish Anand
Updated on 25-Mar-2026 687 Views

AWS Glue workflows can be programmatically controlled using the Boto3 library. This article demonstrates how to stop a running workflow in AWS Glue Data Catalog using Python. Prerequisites Before stopping a workflow, ensure you have ? AWS credentials configured (via AWS CLI or environment variables) Boto3 library installed: pip install boto3 Appropriate IAM permissions for AWS Glue operations A running workflow with a valid workflow_name and run_id Method: Using stop_workflow_run() The stop_workflow_run() method requires two mandatory parameters ? Name − The workflow name to stop RunId − The unique identifier of ...

Read More

How to use Boto3 to start a workflow in AWS Glue Data Catalog

Ashish Anand
Ashish Anand
Updated on 25-Mar-2026 884 Views

In this article, we will see how to start a workflow in AWS Glue Data Catalog using the boto3 library. AWS Glue workflows help orchestrate ETL jobs and crawlers in a defined sequence. Problem Statement Use the boto3 library in Python to programmatically start an AWS Glue workflow and handle potential errors during execution. Prerequisites Before running this code, ensure you have: AWS credentials configured (via AWS CLI, environment variables, or IAM roles) boto3 library installed: pip install boto3 An existing workflow in AWS Glue Data Catalog Appropriate IAM permissions for Glue operations ...

Read More

How to use Boto3 to stop a trigger in AWS Glue Data Catalog

Ashish Anand
Ashish Anand
Updated on 25-Mar-2026 538 Views

In this article, we will see how to stop a trigger in AWS Glue Data Catalog using the boto3 library in Python. AWS Glue triggers are used to start ETL jobs based on schedules or events, and sometimes you need to stop them programmatically. Prerequisites Before running the code, ensure you have: AWS credentials configured (via AWS CLI, environment variables, or IAM roles) boto3 library installed: pip install boto3 Appropriate IAM permissions for Glue operations Approach to Stop a Glue Trigger Step 1: Import boto3 and botocore exceptions to handle errors Step ...

Read More

How to use Boto3 to start a trigger in AWS Glue Data Catalog

Ashish Anand
Ashish Anand
Updated on 25-Mar-2026 699 Views

In this article, we will see how to start a trigger in AWS Glue Data Catalog using the boto3 Python library. Triggers in AWS Glue are used to start ETL jobs based on schedules or events. Prerequisites Before starting, ensure you have ? AWS credentials configured (access key, secret key) Appropriate IAM permissions for AWS Glue operations An existing trigger in your AWS Glue Data Catalog The boto3 library installed Approach to Start a Glue Trigger Follow these steps to start a trigger programmatically ? Step 1: Import boto3 and botocore ...

Read More

How to use Boto3 to start a crawler in AWS Glue Data Catalog

Ashish Anand
Ashish Anand
Updated on 25-Mar-2026 2K+ Views

In this article, we will see how to start a crawler in AWS Glue Data Catalog using Python's boto3 library. A crawler automatically discovers and catalogs metadata about your data sources. Problem Statement Use boto3 library in Python to programmatically start an AWS Glue crawler. Algorithm to Solve This Problem Step 1: Import boto3 and botocore exceptions to handle errors Step 2: Define a function that accepts crawler_name as parameter Step 3: Create an AWS session using boto3. Ensure region_name is configured in ...

Read More
Showing 4991–5000 of 61,299 articles
« Prev 1 498 499 500 501 502 6130 Next »
Advertisements