Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

create dictionary from string python

# Python3 code to convert 
# a string to a dictionary
  
# Initializing String 
string = "{'A':13, 'B':14, 'C':15}"
  
# eval() convert string to dictionary
Dict = eval(string)
print(Dict)
print(Dict['A'])
print(Dict['C'])
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #create #dictionary #string #python
ADD COMMENT
Topic
Name
5+2 =