{"id":24470,"date":"2021-10-17T18:44:47","date_gmt":"2021-10-17T13:14:47","guid":{"rendered":"https:\/\/python-programs.com\/?p=24470"},"modified":"2021-11-05T19:25:08","modified_gmt":"2021-11-05T13:55:08","slug":"program-for-python-string-isdigit-method","status":"publish","type":"post","link":"https:\/\/python-programs.com\/program-for-python-string-isdigit-method\/","title":{"rendered":"Program for Python String isdigit() Method"},"content":{"rendered":"

In the previous article, we have discussed Python Program for isdecimal() Function<\/a>
\nisdigit() Function in Python:<\/strong><\/p>\n

If all of the characters are digits, the isdigit() method returns true; otherwise, it returns False.<\/p>\n

Exponents, such as \u00b2, are also considered digits.<\/p>\n

Syntax:<\/strong><\/p>\n

string.isdigit()<\/pre>\n

Parameters: <\/strong>This function has no parameters.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given first string = \"\\u0039\"\r\nGiven second string = \"\\u00B2\"<\/pre>\n

Output:<\/strong><\/p>\n

The above given first string is : 9\r\nThe given first string after applying isdigit() function: True\r\nThe above given second string is : \u00b2\r\nThe given second string after applying isdigit() function: True<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given first string = \"345.67\"\r\nGiven second string = \"python_12345\"<\/pre>\n

Output:<\/strong><\/p>\n

The above given first string is : 345.67\r\nThe given first string after applying isdigit() function: False\r\nThe above given second string is : python_12345\r\nThe given second string after applying isdigit() function: False<\/pre>\n

Program for isdigit() Function in Python<\/h2>\n