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

Popular posts from this blog

javascript - WinJS appendTextAsync producing scheduler errors -

minify - Minimizing css files -

Sockets with kotlin -