Printing modules contents

Michael Hudson mwh21 at cam.ac.uk
Thu Dec 7 10:25:00 EST 2000


joonas <keisari_ at hotmail.com> writes:

> I tried this but it didnt worked.
> 
> <clip>
> import sys
> list = dir(sys)
> for x in list:
>   print x," = ",sys.x

print x,"=",repr(getattr(sys,x))

should work.

The output might be a bit bigger than you want, though...

M.

-- 
  The ability to quote is a serviceable substitute for wit.
                                                -- W. Somerset Maugham



More information about the Python-list mailing list