c.execute('''
CREATE TABLE IF NOT EXISTS NAME_TABLE(
id_stud INTEGER NOT NULL PRIMARY KEY,
number_zach INTEGER NOT NULL,
password INTEGER NOT NULL,
group_name TEXT NOT NULL)
''')
c.execute('''SELECT * FROM NAME_TABLE WHERE group_name = ?''', (group_name, ) )
import time
stroka = input("")
num_chars = 20 # размер окна символов
for i in range(num_chars+1):
print((" "*i + stroka)[:num_chars], end="\r", flush=True)
time.sleep(1) # Время в мс
SELECT nomencl, start_quantity, start_amount, sum(start_amount) over() total_start_amount from my_table
import xlwt
import xlrd
from xlutils.copy import copy as xlcopy
filename = "test.xls"
try:
book = xlrd.open_workbook(filename)
sheet = book.sheet_by_index(0)
last_row = sheet.nrows
book = xlcopy(book)
sheet = book.get_sheet(0)
except Exception as e:
print(e)
book = xlwt.Workbook()
sheet = book.add_sheet("Sheet1")
last_row = 0
# твои данные для занесения
data = [
['player1', 'win', '101'],
['player2', 'lose', '102']]
for row_index, row in enumerate(data, last_row):
for col_index, value in enumerate(row):
sheet.write(row_index, col_index, value)
book.save(filename)
import xlwt
book = xlwt.Workbook()
sheet1 = book.add_sheet("Sheet1")
# твои данные для занесения в Excel
data = [
['player1', 'win', '101'],
['player2', 'lose', '102']]
for row_index, row in enumerate(data):
for col_index, value in enumerate(row):
sheet1.write(row_index, col_index, value)
book.save("test.xls")
if any(all(cell in ocells for cell in combo) for combo in win_combos):
# есть совпадение комбинации нулей
oset = set(ocells)
if any(not(set(combo)-oset) for combo in win_combos):
{'Интендификатор мастера': 0, '654': [1, 3, 4], '2425': 2, '—': [5, 6, 7, 8, 9, 10]}
{'Интендификатор мастера': [0], '654': [1, 3, 4], '2425': 2, '—': [5, 6, 7, 8, 9, 10]}
a = ['p', 'p', 'p', 'p', 'p', 'p', 'figure', 'h2', 'figure', 'p', 'p', 'p', 'p', 'p', 'p']
patt = ['p', 'figure', 'h2', 'figure']
if any(a[i:i+len(patt)] == patt for i in range(len(a)-len(patt))):
print('found')
# coding:utf-8
return words
text = base_work.all_id()
bot.send_message(message.chat.id, 'В течении 3 секунд, отправиться всем пользователям!')
for i, *_ in text:
@bot.callback_query_handler(func=lambda call:True)
def call_handler(call):
if call.data == "first":
bot.send_message(call.message.chat.id, text="Введите свой вопрос")
elif call.data == "sec":
bot.send_message(call.message.chat.id, text="Пришлите свои варианты ответа в столбик")
@bot.callback_query_handler(func=lambda call:True)
def call_handler(call):
if call.data == "first":
call_opros(call)
elif call.data == "sec":
call_answer(call)
def call_opros(call):
bot.send_message(call.message.chat.id, text="Введите свой вопрос")
def call_answer(call):
bot.send_message(call.message.chat.id, text="Пришлите свои варианты ответа в столбик")
new_news = []
soup = BeautifulSoup(page.text, "html.parser")
news = soup.findAll('a', class_='news-item')
for i in range(len(news)):
if news[i].find('span', class_='title') is not None:
new_news.append(f"{news[i]['href']} {news[i].text}")
bot.send_message(message.chat.id, ('\n'.join(new_news[:5])))
for i in range(len(news)):
news[i]['href']
использовать
for item in news:
item['href']
Сам по себе shuffle 200 тыс элементов не будет занимать "очень много времени".