Python

Working with Raw Strings in Python

Updated: May 28, 2023 By: Khue

Quick Overview In Python, raw strings are string literals prefixed with the letter r. They are used to treat backslashes (/) as literal characters, ignoring their escape sequence…

Python: 8 Ways to Concatenate Strings

Updated: May 27, 2023 By: Frienzied Flame

String concatenation is the process of combining two or more strings into a single string. This pithy, example-based article shows you a couple of different ways to concatenate…

Python: Count the frequency of each word in a string (2 ways)

Updated: May 27, 2023 By: Khue

This succinct and straight-to-the-point article will walk you through some different ways to find the frequency (the number of occurrences) of each word in a string in Python….

Python: 3 ways to convert a string to a hexadecimal value

Updated: May 27, 2023 By: Khue

In Python and the world of software development, a hexadecimal value (or hex value) is a representation of a number using base-16 digits and alphabets. It consists of…

Python: 3 ways to compare 2 strings ignoring case sensitivity

Updated: May 26, 2023 By: Khue

Ignoring case when comparing strings is useful in scenarios where you want to perform case-insensitive matching, especially when validating user input (e.g., email addresses, usernames, captchas, coupon codes)….

Python: How to check if a string is empty

Updated: May 26, 2023 By: Goodman

Python does not have built-in methods or attributes like is_empty() or is_empty specifically designed to check whether a string is empty. However, there are other ways to achieve…

Python: 4 Ways to Generate Random Strings

Updated: May 26, 2023 By: Goodman

In modern Python projects, random strings are commonly used for multifarious purposes, such as originating identifiers (IDs) for database records, making secure passwords or authentication tokens, uniquely naming…

Python: 4 Ways to Count Words in a String

Updated: May 25, 2023 By: Frienzied Flame

This practical, example-based article will walk you through a couple of different ways to count the number of words in a given string in Python. Let’s get right…

Python: Capitalize the First Letter of each Word in a String

Updated: June 1, 2023 By: Wolf

This concise and straightforward article will show you four different ways to capitalize the first letter of each word in a given string in Python. Using the title()…

Python: 4 Ways to Declare a Multiline String (Block String)

Updated: May 25, 2023 By: Wolf

This concise, straight-to-the-point article shows you a couple of different ways to declare a multiline string (block string) in Python. Using Triple Quotes (Recommended) You can use triple…

1 57 58 59 60 61 64