[Tutor] a quick Q: how to use for loop to read a series of files with .doc end

Andreas Perstinger andreas.perstinger at gmx.net
Sat Oct 8 08:50:34 CEST 2011

On 2011-10-08 08:25, lina wrote:
>>  Still have a reading "multiple" files issue:
>>>  Traceback (most recent call last):
>>>    File "counter-vertically-WORKING.**py", line 26, in<module>
>>>      results[ch][col]+=1
>>>  IndexError: list index out of range
>>>  only one file ss_1.xpm was processed and wrote file, for the rest
>>>  ss_2.xpm,
>>>  ss_3.xpm and following keep intact,
>>>  any suggestions?
> https://docs.google.com/leaf?id=0B93SVRfpVVg3MjIxZGI5YWQtN2NiYy00MWFkLWE0ZTctNjExNGJiNjYzYjQw&hl=en_GB
> https://docs.google.com/leaf?id=0B93SVRfpVVg3YjQ1ZWRkMjUtNmZhYS00MTA4LTg3YTktY2JjYzEyMDU5OTI2&hl=en_GB
> https://docs.google.com/leaf?id=0B93SVRfpVVg3YjQ1ZWRkMjUtNmZhYS00MTA4LTg3YTktY2JjYzEyMDU5OTI2&hl=en_US
> you may rename ss_1.xpm to the ss_2 or 3, keep them the same is okay, just
> different names.

Ok, I just ran your script with this files and don't get an error. 
Except some stylistic issues the code looks fine. The resulting 
txt-files still have the problem with the leading '[' and trailing ']' 
but I've already suggested a solution earlier today.

Do you still get an error?

Bye, Andreas

More information about the Tutor mailing list