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 isnumeric() Method

Python String isnumeric() Method

When a Python program receives text that may contain numeric characters, you can check those characters before choosing how to handle the value. The str.isnumeric() method reports whether a non-empty string consists entirely of Unicode numeric characters, but it does…

getpass Python: Hide Password Input

getpass Python: Hide Password Input

Writing a Python program that asks for a password calls for a prompt that does not display ordinary typing. Python’s built-in getpass module reads the password while hiding its characters in a supported terminal. This article shows how to call…

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…