Pankaj Kumar

Pankaj Kumar

I have been working on Python programming for more than 12 years. At AskPython, I share my learning on Python with other fellow developers.
Python String endswith() Function

Python String endswith() Function

A text value may need to match one expected ending or one of several alternatives. Python’s str.endswith() method checks whether a string ends with the supplied suffix and returns True or False. This article explains how to pass several suffixes…

How to Split a String in Python

How to Split a String in Python

To turn a sentence into separate words, you can split its text at whitespace. Python’s str.split() returns the pieces as a list of strings and can also use a separator you specify. I’ll show how to choose a separator and…

lower function in Python: Use str.lower()

Python String islower() Function

Working with letter case in Python can mean changing text or checking how it is already cased. The str.lower() method returns a lowercase copy of a string, while islower() reports whether its cased characters are lowercase. I’ll show how to…

Python isdigit: Check Unicode Digits in Strings

Python isdigit: Check Unicode Digits in Strings

Checking whether a string contains digit characters is different from checking whether Python can parse it as an integer. Python’s str.isdigit() method tests whether every character in a non-empty string is a qualifying Unicode digit. I’ll show how to use…

Python String Capitalize: Method and Examples

Python String Capitalize: Method and Examples

Capitalizing a Python string can mean changing its first character, each word, or every cased letter. The capitalize() method titlecases the first character and lowercases the remainder. You’ll see what capitalize() returns for empty and punctuation-first strings, then compare methods…