Search
 
SCRIPT & CODE EXAMPLE
 

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'])
Comment

PREVIOUS NEXT
Code Example
Python :: tf dropout 
Python :: how to close windows in selenium python without quitting the browser 
Python :: how to sort tuples in list python 
Python :: python close file 
Python :: python turtle clear screen 
Python :: get one from dataloader 
Python :: sorted vs sort python 
Python :: python tensorflow is not defined 
Python :: python scanner class 
Python :: zip django template 
Python :: pillow rgb to grayscale 
Python :: python test is nan 
Python :: model checkpoint keras 
Python :: what is imageTk in pil python 
Python :: generate random number from range python 
Python :: discord python webhook 
Python :: correlation python 
Python :: opencv dilate 
Python :: python exceptions 
Python :: how to read numbers from a text file in python 
Python :: python program to solve quadratic equation 
Python :: what does class meta do in django 
Python :: remove duplicates function python 
Python :: np arange shape 
Python :: how to create frequency table in python 
Python :: how to open an image in opencv 
Python :: Python Tkinter SpinBox Widget 
Python :: pygame.rect 
Python :: count decimal number python 
Python :: list tuples and dictionary in python 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =