By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,767 Members | 1,357 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,767 IT Pros & Developers. It's quick & easy.

Re: Programming question

P: n/a
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 <br**********@wni.comwrote:
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 Iam
stuck with 1.5.

Thanks,

Brad

--
http://mail.python.org/mailman/listinfo/python-list
Jun 27 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.