Python Forum
[Solved]Help to iterate through code
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Solved]Help to iterate through code
#6
You need to call check_price for each product. I would refactor the code, changing check_price() to get_price(), a function that returns the current price for a product.
con = sqlite3.connect(MainDatabase)
for product, url, buy_price in con.execute("SELECT Product, URL, Alert_Price FROM AmazonPriceTracker"):
   current_price = get_price(url)
    if current_price < float(buy_price):
        print(f"Buy {product} ${current_price}")
Reply


Messages In This Thread
[Solved]Help to iterate through code - by Extra - Dec-10-2022, 08:32 PM
RE: Help to iterate through code - by deanhystad - Dec-10-2022, 08:57 PM
RE: Help to iterate through code - by Extra - Dec-11-2022, 07:02 PM
RE: Help to iterate through code - by deanhystad - Dec-11-2022, 07:33 PM
RE: Help to iterate through code - by Extra - Dec-11-2022, 10:03 PM
RE: Help to iterate through code - by deanhystad - Dec-11-2022, 10:06 PM
RE: Help to iterate through code - by Extra - Dec-11-2022, 10:21 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Solved] Trying to rerun a snippet of code paracel 3 1,222 Jul-17-2022, 01:49 PM
Last Post: paracel
  No Module found in other directory than source code [SOLVED] AlphaInc 1 2,137 Nov-10-2021, 04:34 PM
Last Post: AlphaInc

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020