eval () method and str () method

eval () method and str () method

#_author: Administrator 
#date: 2019/10/31

A = {
'Q': { 'XXX': 3456}
}
# convert a string into a dictionary
A = STR (A)
Print (type (A)) # <class 'STR'>
Print (a) # '{' Q ': {' XXX ': 3456}}'
# a string into a dictionary
a = the eval (a)
Print (type (a)) # < class 'dict'>
Print (A) {# 'Q': { 'XXX': 3456}}


Guess you like

Origin www.cnblogs.com/startl/p/11769927.html