Re: String to Dictionary conversion in python

2017-09-19 Thread sohcahtoa82
On Thursday, September 14, 2017 at 11:01:46 PM UTC-7, santosh.y...@gmail.com wrote: > Hi, > > Can anyone help me in the below issue. > > I need to convert string to dictionary > > string = " 'msisdn': '7382432382', 'action': 'select', 'sessionId': '123', > 'recipient': '7382432382', 'language

Re: String to Dictionary conversion in python

2017-09-16 Thread Steve D'Aprano
On Sat, 16 Sep 2017 11:29 am, Rustom Mody wrote: >> > py> import ast >> > py> string = " 'msisdn': '7382432382', 'action': 'select', >> > 'sessionId': '123', 'recipient': '7382432382', 'language': 'english'" >> > py> ast.literal_eval('{%s}' % string) >> > {'sessionId': '123', 'recipient': '7382432

Re: String to Dictionary conversion in python

2017-09-16 Thread Piet van Oostrum
Rustom Mody writes: > On Saturday, September 16, 2017 at 2:04:39 AM UTC+5:30, jlad...@itu.edu wrote: > Yeah… I used to think thus > But literal_eval has excessive crud in its error messages: > from ast import literal_eval > literal_eval("{'x':1}") > {'x': 1} > > Ok… > literal_eval

Re: String to Dictionary conversion in python

2017-09-15 Thread Rustom Mody
On Saturday, September 16, 2017 at 2:04:39 AM UTC+5:30, jlad...@itu.edu wrote: > On Thursday, September 14, 2017 at 11:33:56 PM UTC-7, Ian wrote: > > On Fri, Sep 15, 2017 at 12:01 AM, wrote: > > > Hi, > > > > > > Can anyone help me in the below issue. > > > > > > I need to convert string to dicti

Re: String to Dictionary conversion in python

2017-09-15 Thread jladasky
On Thursday, September 14, 2017 at 11:33:56 PM UTC-7, Ian wrote: > On Fri, Sep 15, 2017 at 12:01 AM, wrote: > > Hi, > > > > Can anyone help me in the below issue. > > > > I need to convert string to dictionary > > > > string = " 'msisdn': '7382432382', 'action': 'select', 'sessionId': '123', > >

Re: String to Dictionary conversion in python

2017-09-14 Thread Ian Kelly
On Fri, Sep 15, 2017 at 12:01 AM, wrote: > Hi, > > Can anyone help me in the below issue. > > I need to convert string to dictionary > > string = " 'msisdn': '7382432382', 'action': 'select', 'sessionId': '123', > 'recipient': '7382432382', 'language': 'english'" > > Can anyone help me with the

Re: String to Dictionary conversion in python

2017-09-14 Thread Bill
santosh.yelamar...@gmail.com wrote: Hi, Can anyone help me in the below issue. I need to convert string to dictionary string = " 'msisdn': '7382432382', 'action': 'select', 'sessionId': '123', 'recipient': '7382432382', 'language': 'english'" Can anyone help me with the code I'm new to Pyt

String to Dictionary conversion in python

2017-09-14 Thread santosh . yelamarthi
Hi, Can anyone help me in the below issue. I need to convert string to dictionary string = " 'msisdn': '7382432382', 'action': 'select', 'sessionId': '123', 'recipient': '7382432382', 'language': 'english'" Can anyone help me with the code -- https://mail.python.org/mailman/listinfo/python-l