I have came across this problem a few times and can\'t seem to figure out a simple solution. Say I have a string
string = \"a=0 b=1 c=3\"
I wan
I sometimes like this approach, especially when the logic for making keys and values is more complicated:
s = "a=0 b=1 c=3" def get_key_val(x): a,b = x.split('=') return a,int(b) ans = dict(map(get_key_val,s.split()))