How to use 'python isdigit' in Python

Every line of 'python isdigit' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
338def isdigit(self): return

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

120def is_digit(thing):
121 """ checks if an object is a digit
123 >>> is_digit(1)
124 True
125 >>> is_digit("1")
126 True
127 >>> is_digit("a")
128 False
129 >>> is_digit([])
130 False
131 """
132 return str(thing).isdigit()

Related snippets