Please tell me the easiest way to convert a list object to a dictionary. All parameters are as follows:
['a=1', 'b=2', ...]
And I want to convert it to:
{'a': '1', 'b': '2' ...}
You can use:
>>> x ['a=1', 'b=2'] >>> >>> dict( i.split('=') for i in x ) {'a': '1', 'b': '2'} >>>
For each element of the split list on an equal symbol and add to the dictionary using the resulting list from split .
split
Source: https://habr.com/ru/post/1500101/More articles:LinearLayout onclick does not translate after TranslateAnimation - androidThe listener after the animation in android does not work - androidTranslateAnimation does not work as expected - javahow to display arabic letters in android using a telephone plug? - androidASP.NET MVC Controller extension method to make the log available to all controllers - c #angularJS reads response cookie parameter empty - angularjsHow to configure vim authentication for proper Haskell programming? - vimProfiles Provisioning Profile Error "Invalid signature not found" - xcodeGetMethod returns null - reflectionno valid personal identifier found? - iphoneAll Articles