Check a variable in python -
i have double variable in python performance want check whether empty or not. following code job?
if re.match("^\d?\.\d+?$", performance) none:
is code checking whether variable empty or not?
to check if values numbers , not empty or string
the right regex pattern below:
performance = '.03' if re.search(r'^(\d*\.)?\d+$', performance): print(performance, 'is digit')
Comments
Post a Comment