Skip to content Skip to sidebar Skip to footer

How To Remove Extraneous Square Brackets From A Nested List Inside A Dictionary?

I have been working on a problem which involves sorting a large data set of shop orders, extracting shop and user information based on some parameters. Mostly this has involved cre

Solution 1:

In second loop use extend instead of append.

for shop in shops: 
    shops_dict[shop].extend(sData[shop])
shops_dict = dict(shops_dict)

Post a Comment for "How To Remove Extraneous Square Brackets From A Nested List Inside A Dictionary?"