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': 'english'"
> 
> Can anyone help me with the code

We're not going to do your homework for you.  What have you tried?  What errors 
are you getting?  If you're replying with your code or an error, make sure to 
use Copy/Paste and DO NOT just manually re-type the code or error.  Also, make 
sure to post the entire traceback.

If literal_eval is out of the question, take a look at the str.split() 
function.  I'd split on a comma, then for each result, split on the colon, then 
strip out the single quotes.

The actual coding of that is an exercise for the reader.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to