<jupyter_start><jupyter_text>All the IPython Notebooks in this lecture series by Dr. <NAME> are available @ **[GitHub](https://github.com/milaan9/02_Python_Datatypes/tree/main/002_Python_String_Methods)**  Python String `isdigit()`The string **`isdigit()`** method returns **`True`** if all characters in the string are digits. If not, it returns **`False`**.**Syntax**:```pythonstring.isdigit()```  `isdigit()` ParametersThe **`isdigit()`** method doesn't take any parameters.  Return Value from `isdigit()`The **`isdigit()`** returns:* **`True`** if all characters in the string are digits.* **`False`** if at least one character is not digits.<jupyter_code># Example 1: Working of isdigit()

s = "28212"
print(s.isdigit())

# contains alphabets and spaces
s = "Mo3 nicaG el l22er"
print(s.isdigit())<jupyter_output>True
False<jupyter_text>**Explanation:**A digit is a character that has property value:* **`Numeric_Type = Digit`*** **`Numeric_Type = Decimal`**In Python, superscript and subscripts (usually written using unicode) are also considered digit characters. Hence, if the string contains these characters along with decimal characters, **`isdigit()`** returns **`True`**.The roman numerals, currency numerators and fractions (usually written using unicode) are considered numeric characters but not digits. The **`isdigit()`** returns **`False`** if the string contains these characters.To check whether a character is a numeric character or not, you can use **[isnumeric()](https://github.com/milaan9/02_Python_Datatypes/blob/main/002_Python_String_Methods/017_Python_String_isnumeric%28%29.ipynb)** method.<jupyter_code># Example 2: String Containing digits and Numeric Characters

s = '23455'
print(s.isdigit())

#s = '²3455'
# subscript is a digit
s = '\u00B23455'
print(s.isdigit())

# s = '½'
# fraction is not a digit
s = '\u00BD'
print(s.isdigit())
# Example 3:

s="I Love 3 Python Tutorial"

print(s.isdigit())
s="123" # Only digit in this string
print(s.isdigit())<jupyter_output>False
True
{'fraction_non_alphanumeric': 0.1410829607550919, 'fraction_numerical': 0.025832091405861898, 'mean_word_length': 6.244604316546763, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '480554', 'license': 'MIT', 'n_tokens_mistral': 703, 'n_tokens_neox': 640, 'n_words': 213, 'path': '002_Python_String_Methods/014_Python_String_isdigit().ipynb', 'repo_name': 'Maxc390/python-discrete-structures', 'size': '2019'}