【发布时间】:2020-04-09 13:33:14
【问题描述】:
我想提取31-Dec-19的日期,但无法提取
IC = requests.get('https://www.reuters.com/companies/IMAX.P/financials/income-statement-annual')
IC = html.fromstring(IC.content)
columns = IC.xpath('//th/span/text()')
>>['Revenue', 'Total Revenue', 'Cost of Revenue, Total', 'Gross Profit', 'Selling/General/Admin. Expenses, Total', 'Research & Development', 'Unusual Expense (Income)'
, 'Total Operating Expense', 'Operating Income', 'Interest Inc.(Exp.),Net-Non-Op., Total', 'Other, Net', 'Net Income Before Taxes', 'Provision for Income Taxes', 'Ne
t Income After Taxes', 'Net Income Before Extra. Items', 'Total Extraordinary Items', 'Net Income', 'Income Available to Com Excl ExtraOrd', 'Income Available to Com
Incl ExtraOrd', 'Diluted Net Income', 'Diluted Weighted Average Shares', 'Diluted EPS Excluding ExtraOrd Items', 'DPS - Common Stock Primary Issue', 'Diluted Normal
ized EPS', 'Interest Exp.(Inc.),Net-Operating, Total', 'Dilution Adjustment', 'Depreciation/Amortization']
请指教如何使用 XPath 提取日期?
【问题讨论】:
-
这个页面因为使用了ajax,你可以尝试另一种方式来做到这一点。
-
@jizhihaoSAMA,你能告诉我怎么做吗?