Traversing through Dir()

Shashwat Anand anand.shashwat at gmail.com
Thu Mar 25 20:59:33 EDT 2010


have you tried os.walk() ?

On Fri, Mar 26, 2010 at 5:55 AM, Andrej Mitrovic <andrej.mitrovich at gmail.com
> wrote:

> I would like to traverse through the entire structure of dir(), and
> write it to a file.
>
> Now, if I try to write the contents of dir() to a file (via pickle), I
> only get the top layer. So even if there are lists within the returned
> list from dir(), they get written as a list of strings to the file.
>
> Basically, I have an embedded and somewhat stripped version of Python.
> I would like to find out just how much functionality it has (I have no
> documentation for it), so I thought the best way to do that is
> traverse thru the dir() call. Any clues as to how I could write the
> whole structure to a file? I guess I'll need some kind of recursion
> here. :)
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100326/9452b413/attachment.html>


More information about the Python-list mailing list