Download a .csv file with Python

前端 未结 2 1238
别那么骄傲
别那么骄傲 2021-01-03 17:13

I am using Python 3.3 on Windows. I am trying to figure out how to download a .csv file from yahoo finance. It is a file for the Historical Prices.

This is the sour

2条回答
  •  失恋的感觉
    2021-01-03 17:34

    since you already use BeautifulSoup and urllib:

    url = BeautifulSoup(html).find('a')['href']
    urllib.urlretrieve(url, '/path/to/downloads/file.csv')
    

提交回复
热议问题