Python
1
Вклад в тег
players = {}
n = int(input('Количество человек в команде '))
for item in range(n):
name = input('Имя ')
size = input('Размер ')
players[name] = size
for item in range(n):
name = input('Введите имя человека ')
if name in players:
print(players[name])
else:
print('Такого человека в команде нет ')
http://www.trafficengland.com/api/events/getAlerts?start=0&step=100&order=Severity&is_current=1&events=CONGESTION,INCIDENT&unconfirmed=false&completed=false&includeUnconfirmedRoadworks=true&_=1573554890656
Вы можете перейти по этой ссылке и посмотреть чем там вам ответили.import requests
from fake_useragent import UserAgent
def request_json():
response = requests.get("http://www.trafficengland.com/api/events/getAlerts?start=0&step=100&order=Severity&is_current=1&events=CONGESTION,INCIDENT&unconfirmed=false&completed=false&includeUnconfirmedRoadworks=true&_=1573554890656", timeout = 5, headers = {'User-Agent': UserAgent().chrome})
fight_all = response.json()
return fight_all
def test_met(responce):
print(responce[0]["gdp"])
test_met(request_json())
function add_applicant_post_callback() {
$title = sanitize_text_field(stripslashes($_POST['title'])) ?? '';
$email = sanitize_text_field($_POST['email']) ?? null;
$phone = sanitize_text_field($_POST['phone']) ?? null;
// create data for new post
$post_data = array(
'post_title' => sanitize_text_field( $title ),
'post_status' => 'publish',
'post_author' => 1,
'post_type' => 'applicant',
);
// create post
$post_id = wp_insert_post( wp_slash($post_data), true );
// checking a post for creation
if( is_wp_error($post_id) ){
wp_send_json_error($post_id->get_error_message());
} else {
require_once(ABSPATH . 'wp-admin/includes/image.php');
require_once(ABSPATH . 'wp-admin/includes/file.php');
require_once(ABSPATH . 'wp-admin/includes/media.php');
update_field( 'email', $email, $post_id );
update_field( 'phone', $phone, $post_id );
}
wp_send_json_success();
}
add_action( 'wp_ajax_nopriv_add_applicant', 'add_applicant_post_callback' );
add_action( 'wp_ajax_add_applicant', 'add_applicant_post_callback' );