getattr for modules not classes

Piet van Oostrum piet at cs.uu.nl
Wed May 24 09:43:55 EDT 2006


>>>>> Heiko Wundram <me+python at modelnine.org> (HW) wrote:

>HW> y.py
>HW> ---
>HW> from x import test
>HW> print test.one
>HW> print test.two
>HW> print test.three
>HW> ---

Or even:
import x
x = x.test
print x.one
print x.two
print x.three

-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org



More information about the Python-list mailing list