params = []
s = "select * from table "
s += "where 1=1 "
if request.form['param1'] != 'Все':
s += "and one = %s "
params.append(request.form['param1'])
if request.form['param2'] != 'Все':
s += "and two = %s "
params.append(request.form['param2'])
if request.form['param3'] != 'Все':
s += "and three = %s"
params.append(request.form['param3'])
rows = cursor.execute(s, tuple(params))
>>> fruits = ['бананы', 'яблоки', 'груши']
>>> for _ in range(10):
print(random.choices(fruits, weights=[0.8, 0.1, 0.1])[0])
бананы
бананы
бананы
груши
бананы
бананы
бананы
бананы
яблоки
бананы
SELECT
@N:=@N + 1 AS '',
(@N * 1) AS '1',
(@N * 2) AS '2',
(@N * 3) AS '3',
(@N * 4) AS '4',
(@N * 5) AS '5',
(@N * 6) AS '6',
(@N * 7) AS '7',
(@N * 8) AS '8',
(@N * 9) AS '9'
FROM
mysql.help_relation,
(SELECT @N:=0) dum
LIMIT 10;
#MY_ELEMENT, #MY_ELEMENT *, #MY_ELEMENT *::before, #MY_ELEMENT *::after{
all: unset
}
params = {'chat_id': user_id}
files = {'audio': open(audio_name, 'rb')}
requests.post('https://api.telegram.org/botxx:xx/sendAudio', data=params, files=files)
function dbget(table, ind, key) {
return new Promise((resolve) => {
let openRequest = indexedDB.open('FV', 6);
openRequest.onsuccess = function() {
let db = openRequest.result;
let transaction = db.transaction(table, 'readonly');
let labs = transaction.objectStore(table);
let index = labs.index(ind);
let request = index.getAll(key);
request.onsuccess = function() {
let res = request.result;
resolve(res);
};
};
});
}