Hi all, I'm confused again with a compare update function. The problem is that my function does not work at all and I don't get it where it comes from.
in my DB I have total of 754 products. when I run the function is says: Total updated: 754 Total not found with in the distributor: 747 I just don't get it, can you find my mistake ? Thanks in advance def Change_price(): total = 0 tnf = 0 for row in DB: # DB is mySQL DB, logically I get out 1 SKU and I compare it with next loop isku = row["sku"] isku = isku.lower() iprice = row["price"] iprice = int(iprice) found = 0 try: for x in PRICELIST:# here is my next loop in a CSV file which is allready in a list PRICELIST try: dprice = x[6] dprice = dprice.replace(",",".") # As in the PRICELIST the prices are with commas I replace the comma as python request it dprice = float(dprice) newprice = round(dprice)*1.10 dsku = x[4] dsku = dsku.lower() stock = int(x[7]) if isku == dsku and newprice < int(iprice):# If found the coresponded SKU and the price is higher than the one in the CSV I update the price print dsku, x[6], dprice, newprice Update_SQL(newprice, isku)# goes to the SQL Update print isku, newprice if isku == dsku:# Just a check to see if it works print "Found %s" %dsku found = 1 else: found = 0 except IndexError: pass except ValueError: pass except TypeError: pass except IndexError: pass if found == 1: print "%s This is match" % isku if found == 0: print "%s Not found" % isku tnf = tnf +1 total = total +1 print "Total updated: %s" % total print"Total not found with in the distributor: %s" % tnf -- http://mail.python.org/mailman/listinfo/python-list