亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

我們如何使用python獲取dist的數據列表

我們如何使用python獲取dist的數據列表

慕勒3428872 2023-07-11 14:30:34
我想從下面的代碼中獲取數據:data=[{'f': [{'@id': '6', '#text': 'Application Review'}, {'@id': '7', '#text': 'final demo'}, {'@id': '8', 'url': '', '#text': 'Sample Document.docx'}, {'@id': '3', '#text': '3'}], 'update_id': '1598972807556'}, {'f': [{'@id': '6', '#text': 'Track Record data'}, {'@id': '7', '#text': 'Track Record data'}, {'@id': '8', 'url': '', '#text': 'Testing Guidelines-QuickBase.docx'}, {'@id': '3', '#text': '1'}], 'update_id': '1597820400040'}]我需要值或文本輸出: Application reveiw   final demo so on謝謝
查看完整描述

1 回答

?
青春有我

TA貢獻1784條經驗 獲得超8個贊

這只是循環遍歷所有各種字典和列表的問題:


>>> data=[{'f': [{'@id': '6', '#text': 'Application Review'}, {'@id': '7', '#text': 'final demo'}, {'@id': '8', 'url': '', '#text': 'Sample Document.docx'}, {'@id': '3', '#text': '3'}], 'update_id': '1598972807556'}, {'f': [{'@id': '6', '#text': 'Track Record data'}, {'@id': '7', '#text': 'Track Record data'}, {'@id': '8', 'url': '', '#text': 'Testing Guidelines-QuickBase.docx'}, {'@id': '3', '#text': '1'}], 'update_id': '1597820400040'}]

>>> print('\n'.join([e['#text'] for d in data for e in d['f']]))

Application Review

final demo

Sample Document.docx

3

Track Record data

Track Record data

Testing Guidelines-QuickBase.docx

1


查看完整回答
反對 回復 2023-07-11
  • 1 回答
  • 0 關注
  • 174 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號