【发布时间】:2020-12-23 14:43:52
【问题描述】:
我通过以下代码下载了历史股票数据。
url = "https://query1.finance.yahoo.com/v7/finance/download/RELIANCE.BO?period1=1577110559&period2=1608732959&interval=1d&events=history&includeAdjustedClose=true"
r = requests.get(url)
然后我尝试通过此代码将其写入csv 文件。
open('ril.csv').write(r.content)
但它给出了错误提示
TypeError: write() argument must be str, not bytes
【问题讨论】:
标签: python-3.x url python-requests data-analysis stock