I always write programs that use + concatenation and forget to keep variable types consistent, as shown below

frame_num = "1"
for i in range(1, frame_num + 1, 1):
    self.by_xpath("//table/tbody/tr[{}]/td[2]/input[1]".format(i)).send_keys(min_price)
    self.by_xpath("//table/tbody/tr[{}]/td[2]/input[2]".format(i)).send_keys(max_price)
Copy the code

The above code is actually a string, but it evaluates to an Int, so remember to convert

for i in range(1, int(frame_num) + 1, 1):
    self.by_xpath("//table/tbody/tr[{}]/td[2]/input[1]".format(i)).send_keys(min_price)
    self.by_xpath("//table/tbody/tr[{}]/td[2]/input[2]".format(i)).send_keys(max_price)
Copy the code

The problem is not so much care