I have a string which is as follows
my_string = '"sender" : "md-dgenie", "text" : "your dudegenie code is 6326. welcome to the world of dudegenie! your wish, my command!", "time" : "1439155575925", "name" : "John"'
I want to construct a dict from the above string. I tried something as suggested here
split_text = my_string.split(",")
for i in split_text :
print i
then I got output as shown below:
"sender" : "md-dgenie"
"text" : "your dudegenie code is 6632. welcome to the world of dudegenie! your wish
my command!" ### finds "," here and splits it here too.
"time" : "1439155803426"
"name" : "p"
I want output as key pair values of a dictionary as given below :
my_dict = { "sender" : "md-dgenie",
"text" : "your dudegenie code is 6632. welcome to the world of dudegenie! your wish, my command!",
"time" : "1439155803426",
"name" : "p" }
Basically I want to skip that "," from the sentence and construct a dict. Any suggestions would be great! Thanks in advance!
my_string? I can't see how that can be a valid string, but then again, python is a weird language so there might be some obscure string formatting I don't know about.my_stringis not a string, or anything else. It is syntactically invalid.my_string. I have updated it.