Ask coding questions

← Back to all posts
Help with asyncio
h
QuantumCodes

I wanted to learn asyncio (for a discord bot)..
I didnt find any good tutorial explaining step by step..(referring to Tutorials at realpython)
So i started to try to test and learn by my own...
I started with keywords: async await and later asyncio.sleep()...
(Repl below)
Why doesnt it print the time? Why does it print an object when i said to print a variable? Can someone explain how to use async n stuff? Or give a good tutorial?

Voters
QuantumCodes
Comments
hotnewtop
JustCoding123

You have to run your function like this x = asyncio.run(wait()).

QuantumCodes

@JustCoding123 works! Why still outputs 1? Shouldn't sleep be run asynchronously

JustCoding123

@QuantumCodes What are you trying to do?

QuantumCodes