Suppose I have the following code:
new_dict = {}
text = "Yes: No Maybe: So"
I want to split the string up into 2 dictionary elements like so:
new_dict = {'Yes':'No', 'Maybe':'So'}
I tried to split the string up into a list in the same fashion to get a brief idea on how to do it, but I haven’t had much success.
1 Answer