python中的列表包含公司股票代码。如果纳斯达克上没有特定的交易品种信息,我该如何传递到下一个交易品种?

时间:2019-02-13 22:01:45

标签: python-3.x if-statement financial

python中的列表包含公司股票代码。如果纳斯达克上没有特定的代码信息,我如何传递到下一个代码?

例如,在纳斯达克(NASDAQ)上没有特定的符号(“ GOOG”)资产负债表信息。如何跳过该符号并移至下一个符号以收集信息。我正在迭代SNP 100公司列表。

我正在尝试if-else语句,它不起作用。

url_form =“ http://www.nasdaq.com/symbol/ {} / financials?query = {}” financials_xpath =“ // tbody / tr / th [text()='{}'] /../ td [contains(text(),'$')]”

对于i,枚举中的符号(符号):

## navigate to income statement annual page
url = url_form.format(symbol, "income-statement")
browser.get(url)

company_xpath = "//h1[contains(text(), 'Company Financials')]"
company = WebDriverWait(browser, 10).until(EC.presence_of_element_located((By.XPATH, company_xpath))).text

quarter_endings_xpath = "//thead/tr[th[1][text() = 'Period Ending:']]/th[position()>=3]"
quarter_endings = get_elements(quarter_endings_xpath)

if quarter_endings and financials_xpath == None:
      continue
  else:
      pass

0 个答案:

没有答案