import re
def spin_words(sentence):
return re.sub(r"\w{5,}", lambda x: x.group()[::-1], sentence)
ignore = {}
@bot.message_handler(content_types=['text'])
def get_text_messages(message):
if ignore.get(message.chat.id):
if message.text == "Жмал включись":
ignore.pop(message.chat.id)
else:
if message.text == "Жмал выключись":
ignore[message.chat.id] = True
elif ...:
...
l = [("a", [1, 3, 5, 6, 7]), ("b", [1, 2, 3, 4, 5]), ("c", [2, 4, 6, 8])]
def func(l):
for x in l:
if all(not i%2 for i in x[1]):
return x
print(func(l))
[ [{"text": ..., "callback_data": "...."}, {"text": ..., "callback_data": "...."}, {"text": ..., "callback_data": "...."}] ]
[ [{"text": ..., "callback_data": "...."}], [{"text": ..., "callback_data": "...."}], [{"text": ..., "callback_data": "...."}] ]
val a = null
println(when (a) {
null -> "it's null"
else -> "it's not null"
})
print(sum(map(lambda x: x if isinstance(x, list) else [x], a_list), []))
a_list = [1, [2, [3]]]
def one_dimens_mass(lst):
new_list = []
for elem in lst:
if type(elem)==list:
new_list+= one_dimens_mass(elem)
else:
new_list.append(elem)
return new_list
print(one_dimens_mass(a_list)
time.time()-(60*60*24)
time_day_before = time()-(60*60*24)
n = 0
for x in lst:
if x < time_day_before:
break
n += 1
print(n)
s = '''\u0412\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u043e\u0444\u0438\u0441\u044b:
- \u041a\u0438\u0435\u0432, \u041a\u0438\u0435\u0432 \u0443\u043b.\u041c\u0435\u0442\u0430\u043b\u043b\u0438\u0441\u0442\u043e\u0432'''
print(s.encode().decode())