On 16 Mai 2005, [EMAIL PROTECTED] wrote:
> Thanks to all who helped me with my questions regarding testing for
> commandline arguments and list assignment. I have finished my first
> Python program (included below). It is slightly more secure than the
> Perl program I rewrote, but also about a t
Thanks to all who helped me with my questions regarding testing for
commandline arguments and list assignment. I have finished my first
Python program (included below). It is slightly more secure than the
Perl program I rewrote, but also about a tenth of a second slower (0.6
seconds for Perl on a
On 14 Mai 2005, [EMAIL PROTECTED] wrote:
> Here's the problem - I want a list (array) of the files in a directory,
> and then I want to iterate over the list testing for image-ness (with
> imghdr.what()) and put all the image filenames in a global list.
>
> What I've tried is this:
>
> files = glo
Hi William,
First, check out the os and os.path modules. It has exactly what you
need to handle files and directories.
http://www.python.org/doc/2.4.1/lib/module-os.html
More specifically:
http://www.python.org/doc/2.4.1/lib/os-file-dir.html
http://www.python.org/doc/2.4.1/lib/module-os.path.html
Here's the problem - I want a list (array) of the files in a directory,
and then I want to iterate over the list testing for image-ness (with
imghdr.what()) and put all the image filenames in a global list.
What I've tried is this:
files = glob.glob('*.*')
for file in files:
global pics