Convert hash to struct

Lie Ryan lie.1296 at gmail.com
Fri Jun 19 16:55:08 EDT 2009


Amita Ekbote wrote:
>  Hello,
> 
> I am retrieving values from a database in the form of a dictionary so
> I can access the values as d['column'] and I was wondering if there is
> a way to convert the hash to a struct like format so i can just say
> d.column. Makes it easier to read and understand.
> 
> Thanks
> Amita
> 


I just remembered something...

If you used python > 2.6, you may also look at namedtuple



More information about the Python-list mailing list