from asyncio import create_task, run, sleep
async def thread_maintaining_communication(seconds: int):
while True: await sleep(seconds) ; print('тут')
async def main():
create_task(thread_maintaining_communication(20))
while True:
print('Сплю 10 сек')
await sleep(10)
run(main())
a = [[1,2,3], [4,5,6]]
res = [(x, y) for i in a for x in i for y in i]
print(res)
if a < x+3: ...
elif b > x-a: ...
else: ...
match a:
case 1: ...
case 2: ...
case _: ...
x = lambda arr, string: next((i for i in arr if i in string), None)
print(x(st, md))
from time import time
lister = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
def mix_list(old: list) -> list:
new = []
while old:
x = str(time()).split('.')[1]
x = list(map(int, [x[0], x[-1]]))
x = x[0] if x[0] <= x[1] else x[1]
if x > len(old)-1:
new.append(old.pop(0))
else:
new.append(old.pop(x))
return new
lister = mix_list(lister)
print(lister)
with open('useful_links.txt', 'r') as f:
companys = []
for line in f.readlines():
if line := line.strip():
q = s.get(line, headers=headers, proxies=prox_list)
result = q.content
...
import requests
r = requests.get('https://api.coinmarketcap.com/data-api/v3/cryptocurrency/market-pairs/latest?slug=polkadot-new&start=1&limit=100&category=spot&sort=cmc_rank_advanced')
[
print({'name': i.get('exchangeName'), 'pair': i.get('marketPair'), 'price': i.get('price'))
for i in r.json()['data']['marketPairs']
]