I have this code below and my IF statement only ran once because missing_amount[i] never equals icl_dollar_amount[i]. How can I correct my script to say if missing amount is in icl_dollar_amount then run? All the missing_amounts ARE in icl_dollar_amount just they dont equal at the time of iteration, but they are inside my icl_dollar_amount list.
print missing amount and icl_dollar_amount:
Missing Amount : 2,760,127.58
ICL DOLLAR 325,845.84
Missing Amount : 325,845.84
ICL DOLLAR 13,389,914.67
Missing Amount : 6,887,299.6
ICL DOLLAR 6,887,299.60
code:
body = browser.find_element_by_xpath("//*[contains(text(), 'Total:')]").text
body_l.append(body)
icl_dollar_amount = re.findall('(?:[\£\$\€]{1}[,\d]+.?\d*)', body)[0].split('$', 1)[1]
icl_dollar_amount_l.append(icl_dollar_amount)
if not missing_amount:
logging.info("List is empty")
print("List is empty")
count = 0
for i in range(len(missing_amount)):
print(i)
print("Missing Amount : ", missing_amount[i])
print("ICL DOLLAR", icl_dollar_amount_l[i])
if missing_amount[i] in icl_dollar_amount_l[i]:
print("Inside the If Statement")
body = body_l[i]
get_company_id = body.split("Customer Id:", 1)[1][4:10].strip()