gl.add_widget(Button(text='=',on_press = self.calc_result))
def calc_result(self, instance):
"UPDATE users SET user_name = COALESCE(?, user_name), user_surname = COALESCE(?, user_surname), username = COALESCE(?, username), phone_number = COALESCE(?, phone_number) WHERE id = ?"
SET user_name = COALESCE(NULLIF(?, ''), user_name),
from pyproj import Transformer
transformer = Transformer.from_crs("epsg:3857", "epsg:4326", always_xy=True)
x1,y1 = ('4702932.98067679','6656376.87212693')
x2,y2 = transformer.transform(x1, y1)
print (x2,y2)
import pandas as pd
data = {
"слово": 1,
"не": 2,
"воробей": 30
}
df = pd.DataFrame(data.items(), columns = ['word', 'value'])
print(df)
df[df['interval'] == 'До внедрения роботов']
cur.execute("SELECT COUNT(*) FROM users WHERE {} == 1".format(mmml))
или
cur.execute(f"SELECT COUNT(*) FROM users WHERE {mmml} == 1")
@bot.message_handler(commands=["api_id"])
def api_id(m, res=False):
bot.send_message(m.chat.id, 'Введите Api ID, полученное на сайте my.telegram.org')
@bot.message_handler(func=lambda message: True, content_types=['text'])
def msg(message):
print(message.text)
f = open('C:/Users/асер/Desktop/python/bot/api_id.txt', 'a')
f.write(message.text + '\n')
f.close()
bot.send_message(m.chat.id, 'Прекрасно!')
@bot.message_handler(commands=["api_id"])
def api_id(m, res=False):
bot.send_message(m.chat.id, 'Введите Api ID, полученное на сайте my.telegram.org')
# указываем запуск следующего шага обработки - свою функцию
bot.register_next_step_handler(message, get_api_id)
def get_api_id(message):
print(message.text)
with open('C:/Users/асер/Desktop/python/bot/api_id.txt', 'a') as f:
f.write(message.text + '\n')
bot.send_message(m.chat.id, 'Прекрасно!')
...
for row in result:
singup = str(row[0])
return singup
...
for row in result:
return str(row[0])
return row[0]
from dataclasses import fields
def combine(elements):
data = {field.name: sum([getattr(elem,field.name) for elem in elements],[]) for field in fields(elements[0])}
return Element(**data)
a = Element(...)
b = Element(...)
...
c = combine([a, b])
import datetime
my_date = datetime.datetime.now()
my_string = my_date.isoformat()
print(my_string)
date_from_string = datetime.datetime.fromisoformat(my_string)
print(date_from_string)
for idx in range(len(items)):
time.sleep(1)
# заново ищем элемент
item = driver.find_element_by_xpath(f"//li[@class='b-custom-drop-down__list-item'][{idx+1}]")
item.click()
...
njson = [item for item in data['data']['list'] if item['user']['name'] == 'name1']
data['data']['list'] = [item for item in data['data']['list'] if item['user']['name'] == 'name1']
sql = "UPDATE users SET balance = balance + \
CASE WHEN buster1 = 'Нет' AND buster2 = 'Нет' AND buster3 = 'Нет' THEN 0.010 \
WHEN buster1 = 'Да' AND buster2 = 'Нет' AND buster3 = 'Нет' THEN 0.050 \
WHEN buster1 = 'Да' AND buster2 = 'Да' AND buster3 = 'Да' THEN 0.100 \
END \
WHERE id = ?"
return bd #возвращаем получившуюся БД
...
btn.pack()
root.mainloop()
def conn():
ut = user_text.get()
root.destroy()
telegram_send.send( messages = ut )