Python rstrip Function | trim string from right

Python rstrip function is used to remove trailing characters (characters at the end a string). Whitespace is the default trailing character to remove if no character passed as parameter. If you want remove (trim string):- All leading White-space – use Python lstrip Function. Leading and trailing spaces- use Python string strip() function. All over Whitespace Read More…


Python lstrip Function | trim string from left examples

Python lstrip() method is used to remove all leading White-space (characters) from the string. There is an option in “lstrip Function” to use or not a char type parameter. If the parameter is not provided, it removes all the leading spaces from the string. Read more topic & links If you want Remove Both side space form Read More…


Python trim string | Python string strip() function

You can trim string in python using a strip() function. It removes the leading and trailing spaces of a given String. There are 2 more methods “lstrip() and rstrip()” can use to remove leading or trailing whitespaces. Note: default whitespace characters will remove, you can remove other char also. Method to trim Stings in Python Read More…


Python string count function | Count total characters in string & occurrences

Python string count function is used to get a number of occurrences of a substring in the given string. Means count() method will search the substring in the given string and returns how many times the substring is have it. Note: count() function is case sensitive, means if you find caps lock word then it will count Read More…


Python check if string is empty or whitespace

You can check if the string is empty or whitespace using an isspace() function and strip() function in python. You can also just use not string with if-else condition statement. Check if the string is “whitespace” in Python First check if string contains whitespace only or not by using a “isspace() function” in python. A function is Read More…


isspace Python function | Check if a string has space

The “isspace Python function” is used to check if there are only whitespace characters in the string. Python String isspace() will return boolean value, if there is space only then true else return False Syntax

Return Value True if all characters in the string are whitespace (space) characters else False. isspace Python function Example Single Read More…


Python string length | len() function and Other ways

The best way to get Python string length is by using len() function. len() function is an inbuilt function in Python programming language. You can use other ways also to find the length of Given a string. Here are the ways to find the length of a string in python without using len() function in Python. for loop and in operator Read More…


len Python | Function to get a length of string, array, list, tuple, dictionary, etc

A “len Python” is an inbuilt function and use for getting a number of items (length) in an object. A len() function can get the length of String, list (Array), tuple, dictionary, etc in Python. Syntax The syntax of len() is:

Parameters Object – a sequence (string, bytes, tuple, list, or range) or a collection Read More…


Python length of list | Get List size | len() Function

To get the length of the list in python you can use len() function. Len() Function is an inbuilt function in python and returns a number of elements present in the list object. Syntax

Return Value This method returns the number of items in the list. Example of get size of list Python

Output: Read More…


Python list insert Function | at End, Front, List into List Examples

Python list insert function is used to insert (add) elements in List. insert() is an inbuilt function in Python. With insert() method you can inserts the specified value at the specified position. Syntax

Parameters index – where an element needs to be inserted. (Required) element – this is the element to be inserted in the list. (Required) Read More…