Dictionary comprehension, tuples?

I was trying to understand

resultList =  [['TWP-883 PASS'], ['TWP-1080 PASS'], ['TWP-1081 PASS']]

result_dicts = [{("issueId","status")[x[0]]:x[1] for x in enumerate(lst[0].split())} for lst in resultList] 

That line of code. Tried to expand that comprehensioned method to classic way.

x =((0, 'TWP-883'),(1, 'PASS'),(0, 'TWP-1080'),(1, 'PASS'),(0, 'TWP-1081'),(1, 'PASS'))

bew ={("issueId", "status")[x[0][0]]:x[0][0]}


I am about to drive crazy, please can anyone explain that syntax ?


Are you just asking for us to explain what’s happening? Here’s 2 other ways to write it if so.

results = []
for i in resultList:
    id, result = i[0].split()
    results.append({"issueId": id, "status": result})

res = [{"issueId": x[0], "status": x[1]} for x in [i[0].split() for i in resultList]]