[
{
option_default_qty_t: "0",
option_name_t: "Пенсионер"
option_price_t: "200",
option_qty_t: "10",
option_qty_t_type: "inputbox",
option_rsv_t: "0",
option_sale_end_date: "2021-03-14",
option_sale_end_date_t: "2021-03-14 00:00",
option_sale_end_time: "00:00",
}, {
option_default_qty_t: "0",
option_name_t: "Ребёнок (до 8 лет)",
option_price_t: "700",
option_qty_t: "10",
option_qty_t_type: "inputbox",
option_rsv_t: "0",
option_sale_end_date: "2021-03-14",
option_sale_end_date_t: "2021-03-14 00:00",
option_sale_end_time: "00:00",
}, {
option_default_qty_t: "0",
option_name_t: "Обычный",
option_price_t: "1500",
option_qty_t: "10",
option_qty_t_type: "inputbox",
option_rsv_t: "0",
option_sale_end_date: "2021-03-14",
option_sale_end_date_t: "2021-03-14 00:00",
option_sale_end_time: "00:00",
}
]
Входные данные
Данные, которые должны получится на выходе
import json
with open('join.json') as f:
original_data = json.load(f)
new_data = []
for element in original_data:
for data in element['data']:
name = data['name']
found = False
for new_element in new_data:
for new_list in new_data:
if new_list[0]['name'] == name:
new_list.append(data)
found = True
break
if found:
break
if not found:
new_data.append([data])
print(new_data)
win = uic.loadUi("main_window.ui")
action = win.findChild(QAction, "your_action_name")
action.triggered.connect(your_object.your_slot)
class MainWindow(QtWidgets.QMainWindow): # ваш базовый класс
def __init__(self):
super(Ui, self).__init__()
uic.loadUi('main_window.ui', self)
action = self.findChild(QAction, "your_action_name")
action.triggered.connect(self.your_slot)
self.show()
def your_slot(self):
pass
widget = uic.loadUi("widget.ui")
widget.show()
<?php
$data = [
'access_token' => 'ключ_доступа_сообщества',
'v' => 5.95
];
$url = 'https://api.vk.com/method/messages.getConversations?' . http_build_query($data);
$data = file_get_contents($url);
$json = json_decode($data, true);
$users = [];
foreach ($json['response']['items'] as $item) {
$userId = $item['conversation']['peer']['id'];
$users[] = $userId;
}
print_r($users, true);