[問題] 照課本範例打卻出現 invalid syntax
冒昧請教各位大大:
小弟是Python新手中的新手,正在閱讀<深入淺出程式設計>一書,
我照著書本第73頁範例打,Run Module的時候卻出現invalid syntax
它標記的地方是urllib那邊有語法錯誤,但我實在看不出來哪邊有問題,
需要麻煩各位高手大大幫小弟看一下:
-----------------------------------------------------------
"每10秒請求一次報價,若咖啡豆價格低於4.74則買入"
import urllib.request
import time
price = 99.99
while price > 4.74:
time.sleep(10)
page = urllib.request.urlopen("http://beans.itcarlow.ie/prices.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!")
-----------------------------------------------------------
--
GRE托福字彙/英語學習/知識分享
我的網誌: http://leeoxygen.wordpress.com/
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 218.164.39.116
→
12/19 16:43, , 1F
12/19 16:43, 1F
→
12/19 16:47, , 2F
12/19 16:47, 2F
→
12/19 17:05, , 3F
12/19 17:05, 3F
→
12/19 17:28, , 4F
12/19 17:28, 4F
Python 近期熱門文章
PTT數位生活區 即時熱門文章