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 :: what does .shape do in python 
Python :: django queryset last 10 
Python :: clean nas from column pandas 
Python :: How to Count occurrences of an item in a list in python 
Python :: apply lambda function to multiple columns pandas 
Python :: pandas groupby mean 
Python :: import numpy financial python 
Python :: take screenshot of video python 
Python :: python copy 
Python :: string to binary python 
Python :: run python notepad++ 
Python :: python check tuple length 
Python :: calculate percentile pandas dataframe 
Python :: check if point is inside polygon python 
Python :: github python projects for beginners 
Python :: 3 dimensional array in numpy 
Python :: difference between supervised and unsupervised learning 
Python :: python open all files of type csv 
Python :: menubar pyqt 
Python :: python pandas give column names 
Python :: uninstall python linux 
Python :: how to convert a list to dataframe in python 
Python :: python insert to sorted list 
Python :: open word from python 
Python :: Python capitalize first letter of string without changing the rest 
Python :: push element to list python 
Python :: how to remove duplicates from a python list 
Python :: python - subset dataframe based on unique value of a clumn 
Python :: see attributes of object python 
Python :: python read json file array 
ADD CONTENT
Topic
Content
Source link
Name
2+4 =