需要帮助将Dictionary输出连接到用于检查网页的字符串

I am web scrapping to get ticker ids for another program I plan to run and save them to a csv. However, they are saved in the format of ['tickerid'].

我用来抓取财务数据的代码本质上是:

url = 'https://finance.yahoo.com/quote/'+result[row]+'.l?p='+result[row]+'.l'

However, this doesn't work because result[row] will come out as:

https://finance.yahoo.com/quote/'['TSCO']'.l?p='['TSCO']'.l

代替:

https://finance.yahoo.com/quote/TSCO.l?p=TSCO.l

How can I remove the [''] so that I can iterate through my dictionary of tickers?

我的结果输出当前看起来像这样:

 'Ticker': 'Ticker', "['100D']": "['100D']", "['100H']": "['100H']", "['1GIS']": "['1GIS']", "['1MCS']": "['1MCS']", "['1PAS']": "['1PAS']", "['2AAP']": "['2AAP']", "['2AMZ']": "['2AMZ']", "['2CIT']": "['2CIT']", "['2CRM']": "['2CRM']", "['2FB']": "['2FB']", "['2GOO']": "['2GOO']", "['2GS']": "['2GS']", "['2JPM']"
评论
  • 本明远
    本明远 回复

    I can't actually see your list result, but it looks like result[row] is itself a list. Please could you display your list result?