Server Side Programming Articles

Page 65 of 2109

Python - Create a string made of the first and last two characters from a given string

Atharva Shah
Atharva Shah
Updated on 27-Mar-2026 3K+ Views

This tutorial demonstrates how to create a new string using the first and last two characters from a given string through string slicing. This technique is useful for data processing, text formatting, and extracting key information from strings. Algorithm Start with the given string Use slicing [:2] to extract the first two characters Use negative slicing [-2:] to extract the last two characters Concatenate both parts to form the new string Basic Example Here's the simple approach to create a new string ...

Read More

How to Create a List of Tuples in Python?

Atharva Shah
Atharva Shah
Updated on 27-Mar-2026 524 Views

In Python, creating a list of tuples is a flexible approach for storing related data items together. Tuples are immutable, ordered collections that are perfect for grouping related information like coordinates, records, or key-value pairs. Basic List of Tuples Creation The simplest way to create a list of tuples is by directly defining them ? # Create a list of tuples containing student records student_records = [ ("Alice Johnson", 25, "A"), ("Bob Smith", 21, "B"), ("Charlie Brown", 23, "A"), ] # Iterate through ...

Read More

Python - Odd Frequency Characters

Sai Mohan Pulamolu
Sai Mohan Pulamolu
Updated on 27-Mar-2026 588 Views

In Python, fetching characters with odd frequencies from a given string can be a very common task in text processing and data analysis. In this article, we will learn various methods to fetch the odd frequency characters of a string in Python. Using a Dictionary Dictionaries are very convenient when there is a need to keep track of the frequencies of elements. We can manually count each character's occurrences and filter those with odd frequencies. Approach To get the odd frequency elements, we will iterate through the entire string, and for each character in the string, ...

Read More

Create a box in Python GTK+ 3

Atharva Shah
Atharva Shah
Updated on 27-Mar-2026 2K+ Views

GTK+ 3 is a sophisticated graphical user interface library for creating cross-platform desktop applications. It provides an extensive range of tools and widgets for building interactive and appealing GUIs. Let's explore how to create and use box layouts in GTK+ 3 to organize widgets within a window. Setup and Installation For Windows users, install the Windows Subsystem for Linux (WSL) to use Linux commands and PyGObject in Windows environments. This simplifies access to libraries and GObject Introspection bindings. Install the required packages: pip install PyGObject sudo apt install libcairo2-dev python3-gi gir1.2-gtk-3.0 gcc libgirepository1.0-dev gobject-introspection pkg-config ...

Read More

Opening Links Using Selenium in Python

Sai Mohan Pulamolu
Sai Mohan Pulamolu
Updated on 27-Mar-2026 3K+ Views

When working with automation tasks, opening links programmatically is a very common requirement. Selenium, a popular web testing framework, provides powerful tools to handle web pages and perform various actions like opening links. In this article, we will learn various methods to open links in Selenium using Python. Prerequisites Before we get started, make sure that you have the following software installed: Python: Install Python, if you haven't already. Selenium: Install Selenium by running pip install selenium in your command prompt. Web Driver: Selenium requires a web driver to interface with the chosen browser. You need ...

Read More

Iterate Through List of Dictionaries in Python

Sai Mohan Pulamolu
Sai Mohan Pulamolu
Updated on 27-Mar-2026 11K+ Views

In this article, we will learn various methods to iterate through a list of dictionaries in Python. When working with data in Python, it is very common to encounter scenarios where you have a list of dictionaries. Each dictionary represents an individual data entry, and you need to perform operations or extract specific information from these dictionaries. Using a For Loop and Dictionary Access Methods The most straightforward approach is to use a for loop to iterate through each dictionary in the list. Inside the loop, we can use dictionary access methods like keys(), values(), or items() to ...

Read More

Iterate Over Words of a String in Python

Sai Mohan Pulamolu
Sai Mohan Pulamolu
Updated on 27-Mar-2026 2K+ Views

In Python, iterating over words in a string is a fundamental skill for text processing and analysis. This article explores various methods to split strings into words and iterate through them efficiently. Using split() Method Syntax string.split(separator, maxsplit) The split() method takes two optional parameters: separator and maxsplit. By default, the separator is any whitespace, and maxsplit is −1, which means the method will split the string at every occurrence of the separator. Example text = "Welcome to tutorials point." words = text.split() print(words) ['Welcome', 'to', 'tutorials', 'point.'] ...

Read More

Pie Syntax (@) in Python

Vishal Gupta
Vishal Gupta
Updated on 27-Mar-2026 434 Views

The @ symbol in Python is called decorator syntax and is used to modify the behavior of functions, methods, or classes. Decorators allow you to wrap another function or class with additional functionality without permanently modifying their code. Syntax @decorator_name def function_name(): # function body Using Function Decorators Basic Decorator Example A decorator function takes another function as an argument and extends its behavior − def my_decorator(func): def wrapper(): print("Before function execution") ...

Read More

Phrase extraction in String using Python

Vishal Gupta
Vishal Gupta
Updated on 27-Mar-2026 411 Views

Phrase extraction in Python is the process of identifying and extracting meaningful segments or phrases from text strings. This technique is commonly used in Natural Language Processing (NLP) applications for text analysis, information retrieval, and content summarization. Python provides several approaches to extract specific portions of text based on word positions or patterns. Let's explore two effective methods for phrase extraction. Using List Slicing and Enumerate This approach finds space positions in the string and extracts phrases based on these positions ? text = 'Website Tutorialspoint is best for reading Python and writing.' print("Original ...

Read More

Pendulum Module in Python

Vishal Gupta
Vishal Gupta
Updated on 27-Mar-2026 943 Views

The Pendulum Module is a powerful Python library for datetime manipulation and time zone management. It provides an intuitive API for handling dates, times, and timezone conversions more elegantly than Python's built-in datetime module. The Pendulum Module's main advantage is its ability to manage time zones easily. It can instantly convert between various time zones and handle dates and times from around the world. You can install this module using the following command ? pip install pendulum Key Methods in Pendulum Module The Pendulum module provides several essential methods for datetime operations ? ...

Read More
Showing 641–650 of 21,090 articles
« Prev 1 63 64 65 66 67 2109 Next »
Advertisements