import urllib.request

price = 99.99

import time

while price > 4.74:

    time.sleep(900)

    page = urllib.request.urlopen("http://beans.itcarlow.ie/prices-loyalty.html")

    text = page.read().decode("utf8")

    where = text.find('>$')

    start_of_price = where + 2

    end_of_price = start_of_price + 4

 

    price = float(text[start_of_price:end_of_price])

print("Buy!")

arrow
arrow
    文章標籤
    python 詢價
    全站熱搜

    Gavem 發表在 痞客邦 留言(0) 人氣()