count = 77.66
count_int = int(count)
count_frac = count - count_int
give_item = []
for i in range(count_int):
give_item.append(Asset(partner_items[i]['id'], game))
for i in range(int(count_frac * 100)):
give_item.append(Asset(partner_items[count_int + i]['id'], game))
steam_client.make_offer_with_url([], give_item, trade_url)
chrome.runtime.onMessage.addListener((message, sender, callback) => {
Promise.resolve(getToken())
.then((tokenResponse) => {
const token = tokenResponse.token;
const http = new HttpService(token, BACKEND);
switch (message.action) {
case 'get-task': {
http.getNewTask().then((response) => {
callback(response);
});
break;
}
case 'confirm-task': {
http.putConfirmTask(message.id).then((response) => {
callback(response);
});
break;
}
}
});
return true;
});
Array.prototype.findIndex()
и Array.prototype.splice()
чтобы обновлять массив без использования filter:filterFunc(obj) {
const index = this.arr.findIndex((elem) => elem.id === obj.id);
if (index === -1) {
this.arr.push(obj);
} else {
this.arr.splice(index, 1);
}
return arr;
}
$args = array(
'post_type' => 'attachment',
'post_mime_type' => 'image',
'post_status' => 'inherit',
'posts_per_page' => 10,
'tax_query' => array(
array(
'taxonomy' => 'media_category',
'field' => 'slug',
'terms' => 'mediaa'
)
)
);
$attachments = get_posts($args);
from bs4 import BeautifulSoup
html = '<input class="form-control" id="nomenclatureSku_children" name="nomenclatureSku[children]" type="hidden" value=\'[{"type":"categories","id":"22869","count":"8","title":" some text","search":"categories_22869"}]\'/>'
soup = BeautifulSoup(html, 'html.parser')
input_element = soup.find('input', {'id': 'nomenclatureSku_children'})
input_value = input_element['value']
import json
value_json = json.loads(input_value)
count = value_json[0]['count']
print(count)
result = {
f'Info{i + 1}':{
'name': name[i],
'tipe': tipe[i],
'number': number[i],
'inv_number': inv_number[i],
'num': num[i],
'dates': {
'data_begin': data_begin[i],
'data_end': data_end[i],
}
} for i in range(len(name))
}
print(result)
result = {}
for i, (name_val, tipe_val, number_val, inv_number_val, num_val, data_begin_val, data_end_val) in enumerate(zip(name, tipe, number, inv_number, num, data_begin, data_end)):
result[f"Info{i+1}"] = {
"name": name_val,
"tipe": tipe_val,
"number": number_val,
"inv_number": inv_number_val,
"num": num_val,
"dates": {
"data_begin": data_begin_val,
"data_end": data_end_val
}
}
import json
json_string = json.dumps(result, indent=4)
{
"Info1": {
"name": "sek",
"tipe": "tip1",
"number": "01",
"inv_number": "111",
"num": "111/1",
"dates": {
"data_begin": "2021",
"data_end": "2022"
}
},
"Info2": {
"name": "ves",
"tipe": "tip2",
"number": "02",
"inv_number": "112",
"num": "222/2",
"dates": {
"data_begin": "2022",
"data_end": "2023"
}
},
...
}
x и y - координаты для размещения текста на картинке
шрифт - имя шрифта (например, Arial)
цвет_текста - цвет текста (например, black)
размер_шрифта - размер шрифта в пунктах (например, 14)
макет.jpg - имя макета
текстовый_файл.txt - имя файла с текстовыми кодами.
Файл сохранится с таким именем код_<текст_строки>.jpg