Commit 805629b3 authored by Adam Caprez's avatar Adam Caprez
Browse files

Add util function to check numeric type

parent 107edb5f
......@@ -47,4 +47,17 @@ def downloadFile(url, localpath, urltype="ftp://", retries=3, overwrite=True, ch
else:
print "File already exists, skipping download.\n"
return
# http://pythoncentral.io/how-to-check-if-a-string-is-a-number-in-python-including-unicode/
def is_number(s):
try:
float(s)
return True
except ValueError:
pass
try:
import unicodedata
unicodedata.numeric(s)
return True
except (TypeError, ValueError):
pass
return False
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment