3 examples of 'isnum python' in Python

Every line of 'isnum python' 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
13def is_num(s):
14 try:
15 int(s)
16 except ValueError:
17 return False
18 else:
19 return True
Important

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

359def isnum(o):
360 return isinstance(o, (int, float))
6def isnum(val):
7 """Check if a value is a number"""
8 # Todo: is there a better way to check this?
9 return isinstance(val, int) or isinstance(val, float) or isinstance(val, long)

Related snippets