Answers for "how to extract dictionary value from string in python"

0

extract values from dict python

>>> d = {1:-0.3246, 2:-0.9185, 3:-3985}

>>> d.values()
<<< [-0.3246, -0.9185, -3985]
Posted by: Guest on January-23-2021
0

how to extract dictionary value from string in python

import ast
temp = "'mycode':['1','2','firstname','Lastname']"
key,value = map(ast.literal_eval, temp.split(':'))
status = {key: value}
Posted by: Guest on September-13-2021

Code answers related to "how to extract dictionary value from string in python"

Python Answers by Framework

Browse Popular Code Answers by Language