test_lst = ["test_" + str(i) for i in range(1, 6)]
itr = iter(test_lst)
def next_quest_gui(m):
markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
markup.add(*[types.KeyboardButton(name) for name in ["Следующее задание", "Выход"]])
bot.send_message(m.chat.id, 'Выберите действие', reply_markup=markup)
def action(m):
send = bot.send_message(m.chat.id, 'Выберите действие')
bot.register_next_step_handler(send, cycle)
@bot.message_handler(commands=["start"])
def start(m, res=False):
bot.send_message(m.chat.id, next(itr))
next_quest_gui(m)
@bot.message_handler(content_types=["text"])
def cycle(m):
if m.text == "Следующее задание":
msg = bot.send_message(m.chat.id, next(itr))
bot.register_next_step_handler(msg, cycle)
else:
bot.send_message(m.chat.id, 'Ваш прогресс сохранен')
'2330', '(0)', '2340'
- вот здесь пропущено еще одно значение.l = ['2110', '760', '10558', '2120', '(439)', '(370)', '2330', '(0)', '2340', '159', '65', '2350', '(98)', '(7)', '2410', '(0)', '(616)', '2400', '382', '9630']
print(*l[0::3], sep=",")
n = 234567
l = list(str(n))
print(" + ".join([i + "**10**" + str(l[::-1].index(i)) for i in l]))
lst = [input() for i in range(2)]
try:
lst.insert(len(lst) // 2, sum([int(i) for i in lst]))
except ValueError:
lst.insert(len(lst) // 2, "".join(lst))
print(*lst)
import re
step_replace = re.compile(r'(Шаг \d+)')
section_replace = re.compile(r'(^\d.+$)', re.MULTILINE)
SUBS = [
(step_replace, r'[COLOR=orange][SIZE=7]\1[/SIZE][/COLOR]'),
(section_replace, r'[COLOR=orange][SIZE=7]\1[/SIZE][/COLOR]'),
]
file = open('d:/text_sample.txt','r')
text = file.read()
def add():
for pattern, replacement in SUBS:
result = re.sub(pattern, replacement, text)
return result
file.close()
file1 = open('d:/text_sample.txt','w')
file1.write(add())
file1.close()