[Tutor] Handling Generator exceptions in Python 2.5
jopython at gmail.com
Fri Jun 19 16:55:51 CEST 2009
I have a generator as follows to do list calculations.
*result = [(ListA[i] - ListB[i-1])/ListA[i] for i in range(len(ListA))]*
The above generator, throws '*ZeroDivisionError*' exception if ListA[i] =
Is there a way to say 'Don't divide by ListA[i] if its equal to 0 (within
Sorry if this question sounds too stupid.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor