Veeeeery Basic Question

Eric Stewart ericstewart at
Sun Feb 27 17:23:05 EST 2000

I'm writing my first script....ever.  I just finished _Learning
Python_ by Lutz.

Here's what I want to do:
Iterate over a series of image files in a given directory.
Randomly select one on those files 
Post that file to a web site.

Each time you hit the web site you will see a different randomly
selected image.

I guess this will be a CGI script that will run in the Directory
cgi-bin, which will be referenced by the HTML.

The image files which i will select from will be in a seperate
directory, i.e C:Web Stuff\Images

Here is the problem I'm having.  (Understand that I've NEVER written
anything before).  How do I iterate over the image files in the
directory?  I thought that a for loop would work.  sort of...

import random

for myFiles in someDirectory:
	return myImage

I keep getting Syntax errors, Token errors.  Can anyone shed a glimmer
of light on this?

eric stewart

More information about the Python-list mailing list