from collections import Counter
counts = Counter(reaction.emoji for reaction in message.reactions)
if counts['✅'] > counts['❌']:
KABOOM()
connect.row_factory = sqlite3.Row
cursor.execute("""SELECT OrderNumber FROM orders ORDER BY OrderNumber DESC LIMIT 1;""")
row = cursor.fetchone()
ID = row['OrderNumber']
@app.on_message(filters.text)
def message(client, message):
msg = message.text
decorator = app.on_message(filters.text)
def message(client, message):
msg = message.text
# функция заменяется на результат работы декоратора - на ту же самую или другую функцию
message = decorator(message)
queue_len = len(self.song_queue[ctx.guild.id])
KeyError: 902227097647468664
result = введённое_тобой_выражение
if result is not None:
print(repr(result))
foo
bar
"foo\nbar"
по видеоуроку ХаудиХо
import sys
import pathlib
script_path = pathlib.Path(sys.argv[0]).parent # абсолютный путь до каталога, где лежит скрипт
conn = sqlite3.connect(script_path / "Database.db") # формируем абсолютный путь до файла базы
with open('afk_users.json', 'w', encoding='utf-8') as file:
file.write(json.dumps(afk_users, indent=4, ensure_ascii=False))
file.close()
with open('afk_users.json', 'w', encoding='utf-8') as file:
json.dump(afk_users, file, indent=4, ensure_ascii=False))
If not None, daemon parameter explicitly sets whether the thread is daemonic. If None (the default), the daemonic property is inherited from the current thread.
daemon
A boolean value indicating whether this thread is a daemon thread (True) or not (False). This must be set before start() is called, otherwise RuntimeError is raised. Its initial value is inherited from the creating thread; the main thread is not a daemon thread and therefore all threads created in the main thread default to daemon = False.
The entire Python program exits when no alive non-daemon threads are left.