quick eval question

craig curtin curtin at ubsw.com
Sat Dec 15 23:08:54 CET 2001


this is a better example of what i'm trying
to do. any suggestions/alternates appreciated.

elements = {}
elements['OUTLOOK'] = {}
elements['OUTLOOK']['CATEGORY'] = 'DEVL_TEST'
elements['OUTLOOK']['AUTHOR'] = {}
elements['OUTLOOK']['AUTHOR']['ADDRESS'] = 'John Smith/Devl'
elements['OUTLOOK']['AUTHOR']['NAME'] = 'Engineering Division'
elements['OUTLOOK']['AUTHOR']['TYPE'] = 'SMTP'
elements['OUTLOOK']['CREATEDATE'] = '12/10/01 17:21:23'

# now i want a 'path component'
ePath ="['OUTLOOK']['CREATEDATE']"

# i can't seem to put the dict and path together
print elements+ePath
#print elements eval(ePath)

#print eval(elements eval(ePath))

hope this makes sense,

craig

curtin at ubsw.com (craig curtin) wrote in message 
> i'm looking to do something like this but my brain is failing...
> 
> i = [1,2,3,4,5]
> j = '[2]'
> 
> k = eval( i j )
> 
> ie. i want to get k = 3 ...



More information about the Python-list mailing list