Convert String representation of a List to a Dictionary Python


How can I convert a str representation of the list , such as the below string into a dictionary ?

a = '[100:0.345,123:0.34,145:0.86]'

Expected output :


First tried to convert the string into a list using ast.literal_eval . But it’s showing an error as : invalid syntax

Python Developer