Programming question

Jeff McNeil jeff at jmcneil.net
Wed Jun 11 14:58:52 EDT 2008


Have a look at os.listdir and os.stat.  I've never worked with 1.5, so
I don't know what will work with it and what won't,. but I'd imagine
the following ought to be fine, though.

stat_list = []
for dirent in os.listdir('your_directory'):
    stat_list.append(os.stat(dirent))

Jeff



On Wed, Jun 11, 2008 at 2:33 PM, Brad Navarro <brad.navarro at wni.com> wrote:
> Greetings,
>
>
>
> Being extremely new to Python, I haven't got the experience to figure this
> one out on my own and frankly I am not sure I would know where to look.
>
>
>
> Basically, what I am trying to do is get a list of each file's attributes
> within a directory. Basically, the information that the 'ls –l' command
> would give you in a linux shell, except the results for each file in the
> directory are stored as a list.
>
>
>
> I am presently using version 1.5 on a linux machine. I have kindly requested
> my system administrator to upgrade to 2.5.2, but until then I am afraid I am
> stuck with 1.5.
>
>
>
>
>
> Thanks,
>
> Brad
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list