I am really stuck with this asyncio for 4 days, read a lot of articles, documents and watched a lot videos still don't understand. Can anyone help me convert this code to asynchronous? and if asynchronous tasks be more than 1 (3-4 enough) that would be great thanks a lot.
IMPORTANT NOTE: Please don^'t use await async.sleep()
, probably the reason why I'm so confused that's because of everyone using await async.sleep()
. I really hate await async.sleep()
, I need real examples.
import datetime
def find_divisibles2(inrange, div_by):
start=datetime.datetime.now()
print("finding nums in range {} divisible by {}".format(inrange, div_by))
located = []
for i in range(inrange):
if i % div_by == 0:
r=located.append(i)
print("Done w/ nums in range {} divisible by {}".format(inrange, div_by))
finish=datetime.datetime.now()
print(finish-start)
find_divisibles2(90000000,5163)
question from:
https://stackoverflow.com/questions/65546063/im-really-stuck-with-for-loops-asyncio 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…