python - How to Convert Tuple to Dictionary? -


i'm using python 2.5 , win xp. have tuple below:

>>> (none, '{1: 2, 2: 4, 3: 6, 4: 8, 5: 10, 6: 12}') >>> a[1] '{1: 2, 2: 4, 3: 6, 4: 8, 5: 10, 6: 12}' >>>  

i want convert tuple a[1] dictionary because want use key , value. pls advise. tq

>>> import ast >>> ast.literal_eval(a[1]) {1: 2, 2: 4, 3: 6, 4: 8, 5: 10, 6: 12} 

Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -