Как решить эту ошибку? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Как решить эту ошибку?

/storage/emulated/0 $ python test.py File "/storage/emulated/0/test.py", line 4 TOKEN= ''5265488332:AAFd-Ga-ZJECYFuv0WfVspWyJ4593O8wekk"" ^ SyntaxError: invalid syntax /storage/emulated/0 $ Это мне выдаёт pydroid 3 при нажатие на кнопку "Terminal" (Создаю телеграмм-бота)

25th Mar 2022, 10:48 AM
Roman Osipov
Roman Osipov - avatar
7 Answers
+ 1
Do you speak english? There seems to be a syntax error. In test.py there shouldn't be a second double quote in the end: TOKEN="52654...8wekk"➡️"⬅️ ❗ Maybe removing the extra double quote it will solve the problem: TOKEN="5265488332:AAFd-Ga-ZJECYFuv0WfVspWyJ4593O8wekk" ✔️
25th Mar 2022, 4:18 PM
Seb TheS
Seb TheS - avatar
+ 1
I guess you have to replace the quotes with == operator: if __name__ == '__#ain__':
29th Mar 2022, 1:36 PM
Seb TheS
Seb TheS - avatar
0
Here is the whole code: from aiogram import Bot, types from aiogram.dispatcher import Dispatcher from aiogram.utils import executor TOKEN="5265488332:AAFd-Ga-ZJECYFuv0WfVspWyJ4593O8wekk" bot =Bot(token=TOKEN) dp=Dispatcher(bot) @dp.message_handler (conten_types=['text']) async def telegram (msg: type.Message): await msg.answer(msg.text.lower()) if __name__"" '__#ain__': executor.start_polling(dp) as you can see, everything is fine with the signs, there are no repetitions " What to do?
26th Mar 2022, 4:01 AM
Roman Osipov
Roman Osipov - avatar
0
There is a weird pair of double quotes in: if __name__➡️""⬅️ '__#ain__':
26th Mar 2022, 10:15 AM
Seb TheS
Seb TheS - avatar
0
I copied the code from one video, there were these quotes and everything worked... What should I do with them?
29th Mar 2022, 9:01 AM
Roman Osipov
Roman Osipov - avatar
0
Yes, thank ...but it is written that the error is in line 4, quotes, but everything is fine with them
29th Mar 2022, 5:20 PM
Roman Osipov
Roman Osipov - avatar
0
Roman Osipov I don't really understand why it says the error would be on line 4, to me line 4 looks fine. Did fixing line 10 fix the problem?
30th Mar 2022, 12:10 PM
Seb TheS
Seb TheS - avatar