我想讓這個python腳本在這個github上工作。從URL中檢索數據,但收到錯誤:迭代器應該返回字符串,而不是字節
https://gist.github.com/lebedov/f09030b865c4cb142af1
腳本從谷歌獲取股票報價。
當我運行的功能stock = get_google_finance_intraday("AAPL")
,我得到的錯誤_csv.Error: iterator should return strings, not bytes (did you open the file in text mode?)
我追查到導致錯誤的代碼行。
這是行39
reader = csv.reader(page.content.splitlines())
我使用Python 3.6版。我懷疑代碼在python v2上運行,但不是v3。