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

Dave Angel d at davea.name
Fri Oct 7 12:25:12 CEST 2011

On 10/07/2011 06:06 AM, Alan Gauld wrote:
> On 07/10/11 09:08, lina wrote:
> <snip>
>>      summary=[]
>>      for a,b in zip(results['E'],results['B']):
>>          summary.append(a+b)
> I don't know why this gives a key error on 'E' (which basically means 
> that there is no key 'E') since the code above should guarantee that 
> it exists. Odd. I'm also not sure why the error occurs after it prints 
> summary. Are you sure the output is in the sequence you showed in your 
> message?
One simple explanation:  it continued on to the next file, which has 
neither "E" nor "B" in it.



More information about the Tutor mailing list