Python help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Python help

But what is the function of async and await in python for? I'm creating a telegram bot with python and an example bot is shown in the official documentation where it uses async def. If I don't put this async it gives me an error.

7th Apr 2023, 2:21 PM
Giovanni Paolo Balestriere
Giovanni Paolo Balestriere - avatar
4 Answers
+ 6
Giovanni Paolo Balestriere you can share code here someone else solve your code and don't dm me personally
7th Apr 2023, 4:48 PM
Sakshi
Sakshi - avatar
+ 5
Please share complete your code I heard about chatgpt can create telegram bot so you can take help from chatgpt also or you can also help from some youtube tutorials according to your understanding https://youtu.be/227uk4kDTM8
7th Apr 2023, 2:27 PM
Sakshi
Sakshi - avatar
+ 5
More information can be found here: https://docs.python.org/3/library/asyncio.html
7th Apr 2023, 2:46 PM
JaScript
JaScript - avatar
0
from telegram import Update from telegram.ext import ApplicationBuilder, ContextTypes, CommandHandler async def start(Update, ContextTypes): await ContextTypes.bot.send_message(chat_id=Update.effective_chat.id, text="I'm a bot, please talk to me!") application = ApplicationBuilder().token('TOKEN').build() start_handler = CommandHandler('start', start) application.add_handler(start_handler) application.run_polling()
8th Apr 2023, 9:09 AM
Giovanni Paolo Balestriere
Giovanni Paolo Balestriere - avatar