I have this variable assignation in my code which take data from web and converts it to float (after extracting numbers only)
variable_1 = float(re.sub('[^0-9]','', basic_data_list[17]))
Now if there is no data on the web (which is specified by "-") I get the error
ValueError: could not convert string to float: which is expected.
Is there any way I can get the value zero assigned to this variable if no data is available? Is there any equivalent of Excels's IsError in python?