如何从字典列表中收集任务aiohttp async python

如何从字典列表中收集任务aiohttp async python,python,Python,我有以下的字典清单: [{'id':1,'url':'https://url1.com“},{'id':2,'url':'https://url2.com“},{'id':3,'url':'https://url3.com'}] 如何使用asyncio.gather将id和url传递给同步方法 理想情况下是这样的: asyncio.get\u event\u loop()。运行\u直到完成( asyncio.gather(*[process(id,url)])#process是另一个分别需要i

我有以下的字典清单:

[{'id':1,'url':'https://url1.com“},{'id':2,'url':'https://url2.com“},{'id':3,'url':'https://url3.com'}]
如何使用
asyncio.gather
id
url
传递给
同步方法

理想情况下是这样的:

asyncio.get\u event\u loop()。运行\u直到完成(
asyncio.gather(*[process(id,url)])#process是另一个分别需要id和url的异步方法
如果我有一个
url列表
,那么我知道我可以很容易地做这样的事情:

asyncio.get\u event\u loop()。运行\u直到完成(
asyncio.gather(*[url\u列表中url的处理(url)])

tvm

列表理解将生成URL列表。比如:

x = [{'id': 1, 'url': 'https://url1.com'}, {'id': 2, 'url': 'https://url2.com'} , {'id': 3, 'url': 'https://url3.com'}]
urls = [a_dict['url'] for a_dict in x]
如果需要
id
url
,则将它们提取为元组列表:

 [ (a_dict['id'], a_dict['url']) for a_dict in x]
 >>>> [(1, 'https://url1.com'), (2, 'https://url2.com'), (3, 'https://url3.com')]