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
pics = []
if imghdr.what(file):
# so far so good - file is a list of files in the directory
pics.append(file)
# I this this is the problem - my list only has the last
# alphabetical entry in it
So there's two questions - is there a better way to create a list of
files in a directory? And, how do I populate my list to get all of the
filenames. I've also tried "pics + [file]", but that gave me an empty
list.
--
yours,
William
signature.asc
Description: Digital signature
_______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
