feat: Semaine 9
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
"""
|
||||
async for
|
||||
async with
|
||||
"""
|
||||
|
||||
import asyncio, aiohttp
|
||||
|
||||
async def check(url):
|
||||
async with aiohttp.ClientSession() as session:
|
||||
async with session.get(url) as response:
|
||||
print(f"{url} : status => {response.status}")
|
||||
|
||||
async def puissance2(stop= 10):
|
||||
exponent = 0
|
||||
while exponent < stop:
|
||||
yield 2 ** exponent
|
||||
exponent += 1
|
||||
await asyncio.sleep(0.2)
|
||||
|
||||
async def main():
|
||||
liste = []
|
||||
async for i in puissance2():
|
||||
liste.append(i)
|
||||
print(liste)
|
||||
|
||||
liste = [j async for j in puissance2()]
|
||||
Reference in New Issue
Block a user