Python processes floating-point numbers entered by Excel
編輯:Python
The processing code is as follows :
def relevantInput(self,step):
input_texts=str(step.InputValue) # step.InputValue It's the input box
if type(step.InputValue) is float: # If the content of the input box is a floating point number
str_inputvalue = str(step.InputValue).split(".")[1] # Extract the number after the decimal point Such as 1.23 extract 23 to str_inputvalue
if str_inputvalue == "0": # Judge If the content is 0
# params = re.findall(r'\${([\s\S]+?)\}', str(str(step.InputValue).split(".")[0]))
input_texts = str(str(step.InputValue).split(".")[0]) # Extract the number before the decimal point
else:
# params = re.findall(r'\${([\s\S]+?)\}', str(step.InputValue))
input_texts = str(step.InputValue) # Not for 0 Words , Then extract all normally
else:
pass