skip to Main Content

Php – Get value from an array and check for individual values

I have 3 dropdowns selects (each drop-down has values from 0 to 25): <select class="form-select" id="select1" name="select1"> <option selected value="0">label...</option> <option value="5">label...</option> <option value="10">label...</option> <option value="15">label...</option> <option value="20">label...</option> <option value="25">label...</option> </select> <select class="form-select" id="select2" name="select2"> <option selected value="0">label...</option> <option value="5">label...</option>…

VIEW QUESTION

Json – API request – TypeError: string indices must be integers

I develop a simple API request. Here is the code: import requests import json #Get data result = requests.get("https://pkip.riga.lv/documentregistration/divisionregister?district_id=516&division_id=2863") divisions = json.loads(result.content) info_list = [] for info in divisions: info_list.append(info["valid_from"]) print (info_list) div_list = list(dict.fromkeys(info_list)) #Sort div_list.sort() #Print for info…

VIEW QUESTION
Back To Top
Search