0

基本上我正试图从雅虎获取 python 中的股票代码。

我通过研究发现,如果不使用 url 转义序列,就不能在 url 中使用 & ,但是每次脚本运行时,它都会下载所需的文件,然后无限期挂起

import os
import subprocess

urlStart = 'http://download.finance.yahoo.com/d/quotes.csv?s=';
urlEnd = '%26f=b2';

fileStart = 'quotes.csv?s=';
stockList = "goog:t:msft:fb:orcl:csco:dell:hpq:intc:amd:qcom";
stockArray = stockList.split(":");
i=0
while(i < len(stockArray)):
    downloadLink = urlStart + stockArray[i] + urlEnd;
    subprocess.Popen(["wget", downloadLink]); 
    fileName = fileStart + stockArray[i];
    i += 1;

我不确定该去哪里。我在 c 中遇到了同样的问题,所以我跳到 python 认为它与 c 相关,但遇到了同样的错误。有小费吗?

4

0 回答 0