Answer the question
In order to leave comments, you need to log in
Error string indices must be integers, how to fix?
Good afternoon!
Please tell me what I'm doing wrong, in this code, I need to transfer data in json format:
import json
import sys
def handle(data):
data = json.loads(data)
arr1 = data['items']
arr2 = data['rates']
arr3 = ''
companiesDict = { n['id']: { k: n[k] for k in ('name', 'disabled') } for n in arr1 }
arr3 = [{ **n, **companiesDict.get(n['company'], {}) } for n in arr2 ]
return arr3
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question