469,360 Members | 1,799 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,360 developers. It's quick & easy.

Re: Programming question

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
0 884

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by G. | last post: by
10 posts views Thread by Rohit | last post: by
7 posts views Thread by Jesse B. | last post: by
2 posts views Thread by Ed_P | last post: by
9 posts views Thread by tjones | last post: by
42 posts views Thread by Kevin Spencer | last post: by
11 posts views Thread by arnuld | last post: by
23 posts views Thread by Dexter | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.