我有一個列表abc
如下。我想將其轉換爲表格,因爲我需要將此數據寫入文件(CSV或任何其他分隔符),然後在Excel中打開該文件。python list convert to a table
在該表中的列將是company, source, time, link, title
,並在列表中的第一個元素,第一行會的價值觀 -
intel corporation,
Motely Fool,
4 hours ago,
http://www.fool.com/investing/general/2016/05/09/intel-corporations-strange-choice.aspx,
Intel Corporation's Strange Choice
我怎麼能達到同樣的? abc
有成千上萬的元素
abc=[{'intel corporation': {'source': u'Motley Fool', 'time': u'4 hours ago', 'link': u'http://www.fool.com/investing/general/2016/05/09/intel-corporations-strange-choice.aspx', 'title': u"Intel Corporation's Strange Choice"}}, {'intel corporation': {'source': u'Seeking Alpha', 'time': u'33 minutes ago', 'link': u'http://seekingalpha.com/article/3973271-intels-augmented-reality-plans-coming-focus', 'title': u"Intel's Augmented Reality Plans Are Coming Into Focus"}}, {'intel corporation': {'source': u'Seeking Alpha', 'time': u'7 hours ago', 'link': u'http://seekingalpha.com/article/3973098-intel-consider-debt-large-buyback', 'title': u'Should Intel Consider More Debt For A Large Buyback?'}}, {'intel corporation': {'source': u'Schaeffers Research (blog)', 'time': u'9 hours ago', 'link': u'http://www.schaeffersresearch.com/content/news/2016/05/09/analyst-downgrades-apple-inc-berkshire-hathaway-inc-and-intel-corporation', 'title': u'Analyst Downgrades: Apple Inc., Berkshire Hathaway Inc., and Intel ...'}}, {'intel corporation': {'source': u'Money News (press release)', 'time': u'Money News (press release)-12 hours ago Explore in depth (11 more articles)', 'link': u'http://www.newsismoney.com/2016/05/09/shares-of-tech-companies-intel-corporation-nasdaqintc-microsoft-corporation-nasdaqmsft-news-update/', 'title': u'Shares of Tech Companies Intel Corporation (NASDAQ:INTC ...'}}, {'intel corporation': {'source': u'Motley Fool', 'time': u'May 6, 2016', 'link': u'http://www.fool.com/investing/general/2016/05/06/why-intel-corporation-quit-smartphones-to-focus-on.aspx', 'title': u'Why Intel Corporation Quit Smartphones to Focus on 5G'}}, {'intel corporation': {'source': u'Motley Fool', 'time': u'May 6, 2016', 'link': u'http://www.fool.com/investing/general/2016/05/06/dont-blame-x86-for-intel-corporations-smartphone-f.aspx', 'title': u"Don't Blame X86 for Intel Corporation's Smartphone Failure"}}, {'intel corporation': {'source': u'Street Updates', 'time': u'11 hours ago', 'link': u'http://www.streetupdates.com/2016/05/09/valuable-analysts-trends-to-observe-intel-corporation-nasdaqintc-taiwan-semiconductor-manufacturing-company-ltd-nysetsm/', 'title': u'Valuable Analysts Trends to Observe: Intel Corporation (NASDAQ ...'}}, {'intel corporation': {'source': u'Motley Fool', 'time': u'May 5, 2016', 'link': u'http://www.fool.com/investing/general/2016/05/05/intel-corporation-its-time-to-replace-ceo-brian-kr.aspx', 'title': u"Intel Corporation: It's Time to Replace CEO Brian Krzanich"}}, {'intel corporation': {'source': u'Amigobulls', 'time': u'Amigobulls-May 5, 2016 Explore in depth (10 more articles)', 'link': u'http://amigobulls.com/articles/intel-corporations-mobile-exit-could-drive-long-term-gains', 'title': u"Intel Corporation's Mobile Exit Could Drive Long-Term Gains"}}, {'intel corporation': {'source': u'Seneca Globe', 'time': u'7 hours ago', 'link': u'http://www.senecaglobe.com/intel-corporation-nasdaqintc-not-great-time-continues-downward-trend-trina-solar-nysetsl/323986/', 'title': u'Intel Corporation (NASDAQ:INTC) Has Not Been Having A Great ...'}}, {'intel corporation': {'source': u'The News Journal', 'time': u'19 minutes ago', 'link': u'http://news4j.com/ruling-stocks-in-todays-market-intel-corporation-nasdaqintc-5/', 'title': u"Ruling stocks in today's market: Intel Corporation (NASDAQ:INTC)"}}]
CSV或任何形式的表,我可以在Excel中打開 – user2543622
'Pandas'是這種工作的一個非常有用的庫,但沒有額外的信息來回答這個問題很難。特別是,它有很好的I/O方法來將數據幀轉換爲csv和許多其他格式(所有格式都很容易命名爲'.to_csv')。你的數據看起來如何? – jdg