We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Category: Strings

Convert list to string in python using join() / reduce() / map()

In this article we will discuss different ways to convert list to string. Convert list to string in python using join() in python In python string class provides a function join() i.e. Advertisements string.join(iterable) join() function accepts an iterable sequence like list or tuple etc as an argument and then joins all items in this …

Convert list to string in python using join() / reduce() / map()Read More

Python : How to iterate over the characters in string ?

In this article we will discuss different ways to iterate or loop over all the characters of string in forward, backward direction and also by skipping over certain characters. Iterate over string using for loop Iterating over the string is simple using for loop and in operator i.e. Advertisements sampleStr = “Hello!!” print(“**** Iterate over …

Python : How to iterate over the characters in string ?Read More

Python : How to replace single or multiple characters in a string ?

In this article we will discuss how to replace single or multiple characters in a string in Python. Python provides a str.replace() function i.e. Advertisements str.replace(old, new , count) It returns a new string object that is a copy of existing string with replaced content. Also, If count is not provides then it will return …

Python : How to replace single or multiple characters in a string ?Read More

Python : How to Compare Strings ? | Ignore case | regex | is vs == operator

In this article we will discuss different ways to compare strings in python like, using == operator (with or without ignoring case) or using is operator or using regex. Python provides various operators to compare strings i.e. +, !=, <, >, <=, >=. When used for comparison these operators return Boolean True or False value. …

Python : How to Compare Strings ? | Ignore case | regex | is vs == operatorRead More

Python : Find occurrence count & all indices of a sub-string in another string | including overlapping sub-strings

In this article we will discuss different ways to count occurrences of a sub-string in another string and also their index positions. Count occurrences of a sub-string in another string using string.count() Python’s String class contains a method to count the non overlapping occurrences of a sub-string in the string object i.e. string.count(s, sub[, start[, …

Python : Find occurrence count & all indices of a sub-string in another string | including overlapping sub-stringsRead More

Python : Check if a String contains a sub string & find it’s index | case insensitive

In this article we will discuss different ways to check if a sub-string exists in another string and if yes then find it’s index. Will also explore ways to check the existence of sub-string in case in-sensitive manner by ignoring case. Check if a String contains another string or character using “in” and “not in” …

Python : Check if a String contains a sub string & find it’s index | case insensitiveRead More

Find frequency of each character in string and their indices | Finding duplicate characters in a string

In this article we will discuss different ways to fetch the frequency or occurrence count of each character in the string and their index positions in the string using collections.Counter() and regex. Get Frequency of each character in string using collections.Counter() collections.counter(iterable-or-mapping) Counter is a dict subclass and collections.Counter() accepts an iterable entity as argument …

Find frequency of each character in string and their indices | Finding duplicate characters in a stringRead More

Cart

Your Cart is Empty

Back To Shop