Code For Five Threads To Process Multiple Files?

tdahsu at gmail.com tdahsu at gmail.com
Wed May 21 10:23:27 EDT 2008


All,

I'd appreciate any help.  I've got a list of files in a directory, and
I'd like to iterate through that list and process each one.  Rather
than do that serially, I was thinking I should start five threads and
process five files at a time.

Is this a good idea?  I picked the number five at random... I was
thinking that I might check the number of processors and start a
multiple of that, but then I remembered KISS and it seemed that that
was too complicated.

If it's not a horrible idea, would anyone be able to provide some
quick code as to how to do that?  Any and all help would be greatly
appreciated!

Thanks in advance!



More information about the Python-list mailing list