Python按关键字索引取dictionary.

AST = ['AGENDA'],["WOMEN'S STATUS", 'TREATIES', 'SIGNATURES, ACCESSIONS, RATIFICATIONS', 'RESERVATIONS AND DECLARATIONS', 'GENDER DISCRIMINATION'], ['ELECTION OF MEMBERS', 'BIOGRAPHY'], [ "WOMEN'S RIGHTS", "WOMEN'S STATUS", 'PERIODIC REPORTS']"


最后采用
>>> {idx: sublist for idx, sublist in enumerate(AST, 1)} {1: ['AGENDA'], 2: ["WOMEN'S STATUS", 'TREATIES', 'SIGNATURES, ACCESSIONS, RATIFICATIONS', 'RESERVATIONS AND DECLARATIONS', 'GENDER DISCRIMINATION'], 3: ['ELECTION OF MEMBERS', 'BIOGRAPHY'], 4: ["WOMEN'S RIGHTS", "WOMEN'S STATUS", 'PERIODIC REPORTS']}

转载于:https://www.cnblogs.com/gamecenter/p/11366548.html

你可能感兴趣的:(Python按关键字索引取dictionary.)