Printing modules contents

joonas keisari_ at hotmail.com
Thu Dec 7 09:59:16 EST 2000


I tried this but it didnt worked.

<clip>
import sys
list = dir(sys)
for x in list:
  print x," = ",sys.x
</clip>

Joonas.


Michael Hudson wrote:
> 
> joonas <keisari_ at hotmail.com> writes:
> 
> > How can I make a script that would print modules contents like below,
> >
> > sys
> >   sys.__name__ = "sys"
> >   sys.stdout = "<PyShell.PseudoFile instance at 7fd530>"
> >   sys.winver = "1.5"
> >   sys.etc = "spam"
> 
> Think "dir" & "repr".  Shouldn't be hard.
> 
> Cheers,
> M.
> 
> --
> 39. Re graphics:  A picture is worth 10K  words - but only those
>     to describe the picture. Hardly any sets of 10K words can be
>     adequately described with pictures.
>   -- Alan Perlis, http://www.cs.yale.edu/homes/perlis-alan/quotes.html



More information about the Python-list mailing list