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

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -