fir3net

PPS-Firenetbanner-780.5x190-30-03-17

Python - Split a String into a Dictionary

To split a string into key value pairs (i.e dict) the following can be used,

>>> string = "abc=123,xyz=456"
>>> dict(x.split('=') for x in string.split(','))
{'xyz': '456', 'abc': '123'}