Answer the question
In order to leave comments, you need to log in
It gives an error can only concatenate str (not "list") to str, how to fix it?
Here is the error
Traceback (most recent call last):
File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 31, in
start(fakepyfile,mainpyfile)
File "/data/user /0/en.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 30, in start
exec(open(mainpyfile).read(), __main__.__dict__)
File "", line 195, in
File " /data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/telebot/__init__.py", line 658, in polling
self.__threaded_polling(non_stop, interval , timeout, long_polling_timeout, allowed_updates)
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/telebot/__init__.py", line 720,in __threaded_polling
raise e
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/telebot/__init__.py", line 680, in __threaded_polling
self.worker_pool.raise_exceptions ()
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/telebot/util.py", line 135, in raise_exceptions
raise self. exception_info
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/telebot/util.py", line 87, in run
task(*args , **kwargs)
File "", line 32, in get_text_messages
TypeError: can only concatenate str (not "list") to str
op = ["Да", "Нет", "Ахахаххаха", "че"]
if message.text == "Жмал алё":
bot.send_message(message.chat.id, "*звонок*")
time.sleep(1)
bot.send_message(message.chat.id, "*слаживаем газетку*")
time.sleep(2)
bot.send_message(message.chat.id, "Да?")
while True:
bot.send_message(message.chat.id, message.text + random.sample(op, k=1))
or rather, the command Zhmal ale works, but if you write something after it, then an error occurs
Answer the question
In order to leave comments, you need to log in
https://habrahabr.ru/post/152389/
Define parts of speech and further, in chains - make substitutions.
You mentioned him in the question, so if he has the default notification settings, then a notification will be sent to the mail.
You just have to wait for the weather by the sea, since it is far from a fact that even after receiving a notification, he will want to contact you.
If you need an algorithm, why wait for the author when you can find it yourself?
You go to GitHub, type in "parser" even in Russian, and you get 1,085 solutions, and if you don't find what you need among them, search in English.
random.sample() returns a list, and you're trying to append it to a string. You can't stack strings with lists. Apparently you want a choice function instead of sample.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question